Here is a script i had in my mIRC folder.

Code:

alias sendmail {
  ;------ SET THESE VALUES THEN CALL /mail -----
  set %sndmail.fromaddress from@email.com
  set %sndmail.toaddress to@email.com
  set %sndmail.subject This is the subject
  set %sndmail.body This is the body
  var %host
  ;------
  ;
  set %sndmail.logfile $+(maillog.,$asctime(dd.mm.yyyy),.txt)
  set %sndmail.state 1
  if ($sock(sendmail)) sockclose sendmail
  ;write %sndmail.logfile # Connect Attempt to 
  sockopen sendmail smtp.server.com 25
}
;
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
    echo 3 -a HELO
    inc %sndmail.state
  } 
  elseif ((%sndmail.state == 2) && ($1 == 250)) { 
    mailsockwrite MAIL From: $+ %sndmail.fromaddress
    echo 3 -a MAIL
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 3) && ($1 == 250)) { 
    mailsockwrite RCPT To: $+ %sndmail.toaddress 
    echo 3 -a RCPT
    inc %sndmail.state
  } 
  elseif ((%sndmail.state == 4) && ($1 == 250)) { 
    mailsockwrite DATA 
    echo 3 -a DATA
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 5) && ($1 == 354)) {
    mailsockwrite Subject: %sndmail.subject 
    mailsockwrite $crlf 
    mailsockwrite %sndmail.body 
    mailsockwrite . 
    echo 3 -a SEND
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 6) && ($1 == 250)) {
    mailsockwrite QUIT
    echo 3 -a QUIT
    inc %sndmail.state
  }
  elseif ((%sndmail.state == 7) && ($1 == 221)) {
    sockclose $sockname
    echo 3 -a DONE
    unset %sndmail.*
  }
  elseif ((%sndmail.state < 0) && ($1 == 221)) {
    sockclose $sockname
    echo 4 -a DONE
    unset %sndmail.*
  }
  else {
    mailsockwrite QUIT
    echo 4 -a ERROR: $1-
    set %sndmail.state -1
  }
} 
;
alias mailsockwrite {
  sockwrite -n $sockname $1-
  ;write %sndmail.logfile $asctime(HH:nn:ss) <- $1-
}





-genius_at_work