alias sendmailcon { sockopen sendmail smtp.comcast.net 25 | set %mail.ok 1 }
on *:text:!mail reset:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
unset %mail.*
sockclose sendmail
}
msg $chan Variables have been reset and mail is now deactivated!
set %email.status off
}
on *:text:!mail send:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
if (%mail.from == $null) { msg $chan You need to set a sender address with !mail sender }
if (%mail.to == $null) { msg $chan You need to set a person to receive the message with !mail rcpt }
if (%mail.body.1 == $null) { msg $chan It helps if you have a message to send use !mail body }
else { sendmailcon }
}
}
on *:sockread:sendmail: {
sockread %sendmail.msg
if ($left(%sendmail.msg,3) == 220) {
sockwrite -n $sockname HELO comcast.net
sockwrite -n $sockname MAIL FROM: %mail.from
}
if ($left(%sendmail.msg,3) == 250) && (%mail.ok == 1) {
sockwrite -n $sockname RCPT TO: %mail.to
inc %mail.ok
}
if ($left(%sendmail.msg,3) == 250) && (%mail.ok == 2) {
sockwrite -n $sockname DATA
inc %mail.ok
}
if ($left(%sendmail.msg,3) == 354) {
sockwrite -n $sockname X-Mailer: StaticSystems
sockwrite -n $sockname FROM: %mail.from
sockwrite -n $sockname TO: %mail.to
sockwrite -n $sockname Subject: %mail.subject
var %x = 1
var %y = $var(%mail.body.*,0)
:begin
if (%x <= %y) {
sockwrite -n $sockname $eval($var(%mail.body.*,%x),2)
inc %x
goto begin
}
sockwrite -n $sockname .
}
if ($left(%sendmail.msg,3) == 250) && (%mail.ok == 3) {
sockwrite -n $sockname QUIT
sockclose $sockname
msg #static Mail Sent
unset %mail.ok
unset %sendmail.msg
}
}
on *:text:!mail prepare:#: {
if ($nick isin %admin.nicks) && (%email.status == off) {
msg $chan Email is ready to be setup
set %email.status on
}
elseif ($nick isin %admin.nicks) && (%email.status == on) {
msg $chan Email is already in progress. If this is an error please !mail reset
}
}
on *:text:!mail sender *:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
set %mail.from $3 | msg $chan From: $3
}
}
on *:text:!mail rcpt *:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
set %mail.to $3 | msg $chan To: $3
}
}
on *:text:!mail subject *:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
set %mail.subject $3- | msg $chan Subject: $3-
}
}
on *:text:!mail body *:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
set %mail.body. $+ $calc($var(%mail.body.*,0) + 1) $3-
msg $chan Body Line ( $+ $var(%mail.body.*,0) $+ ) $3-
}
}
on *:text:!mail verify:#: {
if ($nick isin %admin.nicks) && (%email.status == on) {
msg $chan From: %mail.from
msg $chan To: %mail.to
msg $chan Subject: %mail.subject
var %x = 1
var %y = $var(%mail.body.*,0)
:begin
if (%x <= %y) {
msg $chan $eval($var(%mail.body.*,%x),2)
inc %x
goto begin
}
}
}