Ah. That's because yahoo requires you to authenticate. The simple conversation above doesn't include any authentication process. So, something like:
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
set %sndmail.user your.user@yahoo.com
set %sndmail.pass yourpassword
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.mail.yahoo.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 AUTH LOGIN
echo 3 -a AUTH
inc %sendmail.state
}
elseif ((%sndmail.state == 3) && ($1 == 334)) {
mailsockwrite $encode(%sndmail.user, m)
echo 3 -a AUTH - Username
inc %sendmail.state
}
elseif ((%sndmail.state == 4) && ($1 == 334)) {
mailsockwrite $encode(%sndmail.pass, m)
echo 3 -a AUTH - Password
inc %sendmail.state
}
elseif ((%sndmail.state == 5) && ($1 == 235)) {
mailsockwrite MAIL From: $+ %sndmail.fromaddress
echo 3 -a MAIL
inc %sndmail.state
}
elseif ((%sndmail.state == 6) && ($1 == 250)) {
mailsockwrite RCPT To: $+ %sndmail.toaddress
echo 3 -a RCPT
inc %sndmail.state
}
elseif ((%sndmail.state == 7) && ($1 == 250)) {
mailsockwrite DATA
echo 3 -a DATA
inc %sndmail.state
}
elseif ((%sndmail.state == 8) && ($1 == 354)) {
mailsockwrite Subject: %sndmail.subject
mailsockwrite $crlf
mailsockwrite %sndmail.body
mailsockwrite .
echo 3 -a SEND
inc %sndmail.state
}
elseif ((%sndmail.state == 9) && ($1 == 250)) {
mailsockwrite QUIT
echo 3 -a QUIT
inc %sndmail.state
}
elseif ((%sndmail.state == 10) && ($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-
}
(Note: untested)
Discussion:
There are multiple ways to do an auth request in SMTP. The simplest is the 'PLAIN' method. Unfortunately, this requires mIRC to encode a string with multiple
$chr(0)'s in it. As you can't just throw this into an
$encode(), this makes life a little difficult (Read: I dislike
/bset!). The second simplest is the 'LOGIN' method, which literally asks you for your username and password in separate requests. As this doesn't require any stacking of values, it's more straight forward.
Although more complex and secure methods exist (i.e. 'CRAM-MD5', 'DIGEST-MD5' or 'GSSAPI'), Yahoo only supports LOGIN and PLAIN