mIRC32 - Ejemplos ya programados: Enviar E-Mails. Fecha creación: 05/01/00 - Última revisión: 05/01/00
 
;#################################
; 
;          Sin nombre
;       By S|k^ri0 1.999
;   http://krakatau.cjb.net
;
;#################################


; para iniciar el dialog escribe: /mailkrakatau
; esta utilidad fue kreada por S|k^ri0

on *:sockopen:xmailer: {
  if ($sockerr > 0) { did -o mailx 8 1 error: imposible contactar server | sockclose $sockname | halt }
  did -o mailx 8 1 servidor contactado... | set %var.xmailer 1 | sockwrite -tn $sockname helo $ip
}

on *:sockread:xmailer: {
  sockread %xmailer
  if (250 isin %xmailer) {
    if (%var.xmailer == 1) { inc %var.xmailer | sockwrite -tn $sockname mail from: $did(mailx,3) 
    did -o mailx 8 1 enviando origen ( $+ $did(mailx,3) $+ ) | halt }
    if (%var.xmailer == 2) { inc %var.xmailer | sockwrite -tn $sockname rcpt to: $did(mailx,5) 
    did -o mailx 8 1 enviando destino ( $+ $did(mailx,5) $+ ) | halt }
    if (%var.xmailer == 3) { unset %var.xmailer | sockwrite -tn $sockname data }
    if (%var.xmailer == end) { unset %var.xmailer | sockwrite -tn $sockname QUIT
    did -o mailx 8 1 e-mail enviado con exito | sockclose $sockname }
  }
  if (354 isin %xmailer) {
    did -o mailx 8 1 enviando mensaje...
    sockwrite -tn $sockname From: $did(mailx,3)
    sockwrite -tn $sockname To: $did(mailx,5)
    sockwrite -tn $sockname Subject: $did(mailx,7)
    sockwrite -tn $sockname X-Mailer: krakatau
    unset %var.xmailer | :start | inc %var.xmailer | if ($did(mailx,9).lines >= %var.xmailer) { 
    sockwrite -tn $sockname $did(mailx,9,%var.xmailer) | goto start }
    set %var.xmailer end | sockwrite -tn $sockname .
  }
  if ($gettok(%xmailer,1,32) > 499) { did -o mailx 8 1 error: $gettok(%xmailer,2-,32) | sockclose $sockname }
}
on *:sockclose:xmailer: { sockclose $sockname | did -o mailx 8 1 error: conexion interrumpida }

on *:dialog:mailx:init:0:{
  if (%emaildir1 != $null) { did -o mailx 3 1 %emaildir1 }
  set %var.xmailer.list 0 | :start | inc %var.xmailer.list
  if (%xmailer.dir. [ $+ [ %var.xmailer.list ] ] != $null) {
  did -o mailx 5 %var.xmailer.list %xmailer.dir. [ $+ [ %var.xmailer.list ] ] | goto start }
  did -o mailx 8 1 servidor smtp actual: %xmailer.smtp $iif(%xmailer.smtp == $null , no especificado )
}
on *:dialog:mailx:sclick:*: {
  if ($did == 10) { sockclose xmailer }
  if ($did == 11) { .timer -m 1 1 xmailer.smtp }
  if ($did == 12) {
    if (%xmailer.smtp == $null) { did -o mailx 8 1 error: no ha especificado servidor smtp | halt }
    if (@ !isin $did(mailx,3).text) || (. !isin $did(mailx,3).text) { 
    did -o mailx 8 1 error: datos incompletos o erroneos | halt }
    if (@ !isin $did(mailx,5).text) || (. !isin $did(mailx,5).text) {
    did -o mailx 8 1 error: datos incompletos o erroneos | halt }
    if ($did(mailx,7).text == $null) {
    did -o mailx 8 1 error: datos incompletos o erroneos | halt }
    if ($portfree(25) != $true) { did -o mailx 8 1 error: puerto ocupado... cancelando envio | halt }
    did -o mailx 8 1 enviando mail... momento 
    recientes xmailer.dir. $did(mailx,5) 
    sockopen xmailer %xmailer.smtp 25
  }
}

dialog mailx {
  title "sistema para enviar e-mails"
  size -1 -1 250 300
  box "",1,10 6 230 81
  text "origen",2,20 20 100 22
  edit "",3,58 17 178 22,autohs
  text "destino",4,20 42 100 22
  combo 5,59 39 176 160,edit,drop
  text "subject",6,20 64 100 22
  edit "",7,58 60 178 22,autohs
  edit "",8,10 90 230 20,autohs,read
  edit "",9,10 112 230 140,multi,return,vsbar,hsbar
  button "cancelar",10,10 264 95 25,cancel
  button "smtp",11,105 264 40 25
  button "enviar",12,145 264 95 25
}

alias mailkrakatau { if ($dialog(mailx) == $null) { dialog -dm mailx mailx } | else { did -f mailx 3 } }

alias recientes {
  if ($2- != % [ $+ [ $1 $+ 1 ] ]) {
    if ($2- == % [ $+ [ $1 $+ 2 ] ]) { goto start9 }
    if ($2- == % [ $+ [ $1 $+ 3 ] ]) { goto start8 }
    if ($2- == % [ $+ [ $1 $+ 4 ] ]) { goto start7 }
    if ($2- == % [ $+ [ $1 $+ 5 ] ]) { goto start6 }
    if ($2- == % [ $+ [ $1 $+ 6 ] ]) { goto start5 }
    if ($2- == % [ $+ [ $1 $+ 7 ] ]) { goto start4 }
    if ($2- == % [ $+ [ $1 $+ 8 ] ]) { goto start3 }
    if ($2- == % [ $+ [ $1 $+ 9 ] ]) { goto start2 }
    if ($2- == % [ $+ [ $1 $+ 10 ] ]) { goto start1 }
    :start1 | if (% [ $+ [ $1 $+ 9 ] ] != $null) { set % [ $+ [ $1 $+ 10 ] ] % [ $+ [ $1 $+ 9 ] ] }
    :start2 | if (% [ $+ [ $1 $+ 8 ] ] != $null) { set % [ $+ [ $1 $+ 9 ] ] % [ $+ [ $1 $+ 8 ] ] }
    :start3 | if (% [ $+ [ $1 $+ 7 ] ] != $null) { set % [ $+ [ $1 $+ 8 ] ] % [ $+ [ $1 $+ 7 ] ] }
    :start4 | if (% [ $+ [ $1 $+ 6 ] ] != $null) { set % [ $+ [ $1 $+ 7 ] ] % [ $+ [ $1 $+ 6 ] ] }
    :start5 | if (% [ $+ [ $1 $+ 5 ] ] != $null) { set % [ $+ [ $1 $+ 6 ] ] % [ $+ [ $1 $+ 5 ] ] }
    :start6 | if (% [ $+ [ $1 $+ 4 ] ] != $null) { set % [ $+ [ $1 $+ 5 ] ] % [ $+ [ $1 $+ 4 ] ] }
    :start7 | if (% [ $+ [ $1 $+ 3 ] ] != $null) { set % [ $+ [ $1 $+ 4 ] ] % [ $+ [ $1 $+ 3 ] ] }
    :start8 | if (% [ $+ [ $1 $+ 2 ] ] != $null) { set % [ $+ [ $1 $+ 3 ] ] % [ $+ [ $1 $+ 2 ] ] }
    :start9 | if (% [ $+ [ $1 $+ 1 ] ] != $null) { set % [ $+ [ $1 $+ 2 ] ] % [ $+ [ $1 $+ 1 ] ] }
    set % [ $+ [ $1 $+ 1 ] ] $2-
  }
}

alias xmailer.smtp { 
 set %xmailer.smtp $$?="servidor smtp de salida a usar ? ( $+ %xmailer.smtp $+ )" 
 did -o mailx 8 1 se usará el servidor smtp %xmailer.smtp 
}

 Volver a la página principal