Update.

I wasn't using the one of latest beta which has openssl 3.0. with latest beta, everything works, just sent a test email using starttls and outlook.

Here is a script to send email for outlook and gmail (for gmail, one needs to enable two way auth in google settings as well as generate a password for third party app)


noop $sendmail(o,mail,pass,mailto,subject,mailcontent) for outlook
noop $sendmail(g,mail,pass,mailto,subject,mailcontent) for gmail


alias sendmail {
;$sendmail([og],mail,pass,mailto,subject,mailcontent)
sockclose mailing
if ($1 == o) sockopen mailing smtp.office365.com 587
elseif ($1 == g) sockopen -e mailing smtp.gmail.com 465
else echo -sg * $!sendmail: invalid service
sockmark mailing 0
hadd -m mail service $1
hadd mail mail $2
hadd mail pass $3
hadd mail mailto $4
hadd mail subject $5
hadd mail mailcontent $6
}
on *:sockopen:mailing:if ($sockerr) echo -sg * $!sendmail cannot connect to the smtp server
on *:sockread:mailing:{
if ($sockerr) { echo -sg * $!sendmail an error occured while reading data from the smtp server: $sock($sockname).wsmsg | return }
var %tmp,%m $sock($sockname).mark
sockread %tmp
if (!$sockbr) return
tokenize 32 %tmp
if (!%m) && ($1 == 220) {
if ($hget(mail,service) == g) {
sockwrite -n $sockname HELO mIRC
sockmark $sockname 1
}
elseif ($v1 == o) {
sockwrite -n $sockname $+(EHLO mIRC,$crlf,STARTTLS)
sockmark $sockname -1
}
}
elseif (%m == -1) && ($1 == 220) {
sockopen -t mailing
.timer -m 1 1600 sockwrite -n mailing EHLO mIRC $(|) sockmark mailing 1
}
elseif (%m == 1) && ($1 == 250) {
sockwrite -n $sockname AUTH LOGIN
sockmark $sockname 2
}
elseif (%m == 2) && ($1 == 334) {
sockwrite -n $sockname $encode($hget(mail,mail),m)
sockmark $sockname 3
}
elseif (%m == 3) && ($1 == 334) {
sockwrite -n $sockname $encode($hget(mail,pass),m)
sockmark $sockname 4
}
elseif (%m == 4) && ($1 == 235) {
sockwrite -n $sockname MAIL FROM: < $+ $hget(mail,mail) $+ >
sockmark $sockname 5
}
elseif (%m == 5) {
sockwrite -n $sockname RCPT TO: < $+ $hget(mail,mailto) $+ >
sockmark $sockname 6
}
elseif (%m == 6) && ($1 == 250) {
sockwrite -n $sockname DATA
sockmark $sockname 7
}
elseif (%m == 7) && ($1 == 354) {
sockwrite -n $sockname $+(SUBJECT: $hget(mail,subject),$crlf,$crlf,$replace($hget(mail,mailcontent),$+($crlf,.,$crlf),$+($crlf,..,$crlf)),$crlf,.,$crlf,QUIT)
echo -sg * $!sendmail: email was sent successfully
hfree mail
}
}

Last edited by Wims; 24/04/23 11:16 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel