Make a socket script that connect to your SMTP server and sends the message. SMTP is very easy to use (S = Simple), so it should be easy to create a script to send an email. In fact, I happen to have one that I made a long time ago:


Code:

alias sendmail {
  ;------ SET THE SERVER SETTINGS ------
  set %sndmail.smtpserver your.smtp.server.com
  set %sndmail.smtpport 25
  set %sndmail.debug $true

  ;------ SET THESE VALUES THEN CALL /sendmail -----
  set %sndmail.fromaddress from@address.com
  set %sndmail.toaddress to@address.com
  set %sndmail.subject This is the email subject
  set %sndmail.body This is the email body

  ;------ DON'T EDIT BELOW THIS LINE ------
  ;
  set %sndmail.logfile $+(maillog.,$asctime(dd.mm.yyyy),.txt)
  set %sndmail.state 1
  if ($sock(sendmail)) sockclose sendmail
  write %sndmail.logfile # Connect Attempt to %sndmail.smtpserver $+ : %sndmail.smtpport
  sockopen sendmail %sndmail.smtpserver %sndmail.smtpport
}
;
on *:sockread:sendmail:{ 
  var %temptext
  sockread %temptext
  tokenize 32 %temptext

  write %sndmail.logfile $asctime(HH:nn:ss) -> $1- 
  if ((%sndmail.state == 1) && ($1 == 220)) {
    mailsockwrite HELO localhost
    maildebug 220 -> HELO
    inc %sndmail.state
  } 
  elseif ((%sndmail.state == 2) && ($1 == 250)) { 
    mailsockwrite MAIL From: $+ %sndmail.fromaddress
    maildebug 250 -> MAIL
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 3) && ($1 == 250)) { 
    mailsockwrite RCPT To: $+ %sndmail.toaddress 
    maildebug 250 -> RCPT
    inc %sndmail.state
  } 
  elseif ((%sndmail.state == 4) && ($1 == 250)) { 
    mailsockwrite DATA 
    maildebug 250 -> DATA
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 5) && ($1 == 354)) {
    mailsockwrite Subject: %sndmail.subject 
    mailsockwrite $crlf 
    mailsockwrite %sndmail.body 
    mailsockwrite . 
    maildebug 354 -> SEND
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 6) && ($1 == 250)) {
    mailsockwrite QUIT
    maildebug 250 -> QUIT
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 7) && ($1 == 221)) {
    sockclose $sockname
    maildebug 221 ** DONE
    unset %sndmail.*
  }
  elseif ((%sndmail.state < 0) && ($1 == 221)) {
    sockclose $sockname
    maildebug 221 ** DONE
    unset %sndmail.*
  }
  else {
    mailsockwrite QUIT
    maildebug -> QUIT
    maildebug ** 4ERROR: $1-
    set %sndmail.state -1
  }
} 
;
alias mailsockwrite {
  sockwrite -n $sockname $1-
  write %sndmail.logfile $asctime(HH:nn:ss) <- $1-
}
alias maildebug { if (%sndmail.debug) echo 3 -at $1- }



Change the variables at the top to match your server/email settings, then call /sendmail

You can disable the debug echos by changing %sndmail.debug to $false.

This code can only send 1 email at a time, so you must add your own code to ensure it isn't called a second time before it has finished the first time. The code logs all SMTP traffic to daily logfiles.

-genius_at_work