############################ ## ## ## Sendmail V2.0 by TiSmA ## ## ## ############################ # # Adresse de Sendmail set sendmail(path) "/usr/sbin/sendmail" # Email de l'expéditeur set sendmail(from) "Eggdrop@domaine.org" # Titre des Messages set sendmail(titre) "Mini Email" # Format du mail: Html = 1 Normal = 0 set sendmail(html) "1" # ############### # HTML Activé # ############### # # Police d'ecriture set sendmail(police) "Tahoma" # Taille de l'ecriture set sendmail(tpolice) "2" # Taille du tableau set sendmail(taille) "500" # Couleur de fond set sendmail(fond) "#F0F6FF" # Couleur du Titre set sendmail(tcouleur) "#ff0000" # Couleur de l'ecriture set sendmail(pcouleur) "#004f77" # Couleur de fond du tableau set sendmail(tfond) "#ffffff" # Couleur de la bordure du tableau set sendmail(bord) "#ff0000" # ######## # Bind # ######## # bind pub - !mail envoimail bind msg - mail envoimail2 # ############# # AntiFlood # ############# # set sendmail(flood) 0 proc flood_reset {} { global sendmail set sendmail(flood) 0 foreach th [timers] { if {[lindex $th 1]=="flood_reset"} { killtimer [lindex $th 2] } } } # ######## # Proc # ######## # proc envoimail {nick host hand chan arg} { global sendmail envoi botnick set char [charfilter $arg] set email [lindex $char 0] set message [lrange $char 1 end] set sendmail(flood) [expr $sendmail(flood) + 1] if {$sendmail(flood) > 2} {return 0} timer 1 flood_reset if {![string match *@* $email]} { putserv "NOTICE $nick :\002Commande Mail :\002 !mail " return 0 } if {![string match *.* $email]} { putserv "NOTICE $nick :\002Commande Mail :\002 !mail " return 0 } if {$message==""} { putserv "NOTICE $nick :\002Commande Mail :\002 !mail " return 0 } set envoi(mailer) $nick set envoi(email) $email set envoi(message) $message if {$sendmail(html)=="1"} { okhtml } else { nonhtml } return 0 } # proc envoimail2 {nick host hand arg} { global sendmail envoi botnick set char [charfilter $arg] set email [lindex $char 0] set message [lrange $char 1 end] set sendmail(flood) [expr $sendmail(flood) + 1] if {$sendmail(flood) > 2} {return 0} timer 1 flood_reset if {![string match *@* $email]} { putserv "NOTICE $nick :\002Commande Mail :\002 /msg $botnick mail " return 0 } if {![string match *.* $email]} { putserv "NOTICE $nick :\002Commande Mail :\002 /msg $botnick mail " return 0 } if {$message==""} { putserv "NOTICE $nick :\002Commande Mail :\002 /msg $botnick mail " return 0 } set envoi(mailer) $nick set envoi(email) $email set envoi(message) $message if {$sendmail(html)=="1"} { okhtml } else { nonhtml } return 0 } # ################# # Mail non HTML # ################# # proc nonhtml {} { global sendmail envoi set sendmail(mail) [open "|$sendmail(path) -t" w] puts $sendmail(mail) "To: $envoi(email)" puts $sendmail(mail) "From: $sendmail(from)" puts $sendmail(mail) "Subject : $sendmail(titre)" puts $sendmail(mail) "" puts $sendmail(mail) "$envoi(message)" puts $sendmail(mail) "" puts $sendmail(mail) "Posté par $envoi(mailer)" puts $sendmail(mail) "." close $sendmail(mail) putserv "NOTICE $envoi(mailer) : Votre Email a bien été transmit à $envoi(email)" unset envoi } # ############# # Mail HTML # ############# # proc okhtml {} { global sendmail envoi botnick set sendmail(mail) [open "|$sendmail(path) -t" w] puts $sendmail(mail) "To: $envoi(email)" puts $sendmail(mail) "From: $sendmail(from)" puts $sendmail(mail) "Subject : $sendmail(titre)" puts $sendmail(mail) "MIME-Version: 1.0" puts $sendmail(mail) "Content-type: text/html; charset=iso-8859-1" puts $sendmail(mail) "" puts $sendmail(mail) "" puts $sendmail(mail) "" puts $sendmail(mail) "

" puts $sendmail(mail) "" puts $sendmail(mail) "" puts $sendmail(mail) "
" puts $sendmail(mail) "" puts $sendmail(mail) "" puts $sendmail(mail) "
 
" puts $sendmail(mail) "
$sendmail(titre) par $botnick

" puts $sendmail(mail) "$envoi(message)

" puts $sendmail(mail) "
$envoi(mailer)
" puts $sendmail(mail) "

" puts $sendmail(mail) "
 


" puts $sendmail(mail) "" puts $sendmail(mail) "." close $sendmail(mail) putserv "NOTICE $envoi(mailer) : Votre Email a bien été transmit à $envoi(email)" unset envoi } # ############## # Charfilter # ############## # proc charfilter {word {nword ""} } { for {set i 0} {$i < [string length $word]} {incr i} { switch -- [string index $word $i] { "\"" {append nword "\\\""} "\\" {append nword "\\\\"} "\[" {append nword "\\\["} "\]" {append nword "\\\]"} "\}" {append nword "\\\}"} "\{" {append nword "\\\{"} default {append nword [string index $word $i]} } } return $nword } # ########## # Putlog # ########## # putlog "Sendmail V2.0 by TiSmA"