autoit _INetSmtpMail non funzionante

« Older   Newer »
  Share  
Crazy_Mauro
CAT_IMG Posted on 25/5/2008, 19:58     +1   -1




CODICE
#include <INet.au3>

$s_SmtpServer = "mail.libero.it"
$s_FromName = "Prova"
$s_FromAddress = "prova@hotmail.it"
$s_Subject = "Prova"
$as_Body = "Prova"
$s_ToAddress = "prova2@live.it"

$mail = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress ,$s_Subject ,$as_Body)
        If $mail = 1 Then
                MsgBox(0, "Mail", "Invio avvenuto con successo")
        Else
                MsgBox(0, "Errore Mail", "L'E-mail non è stata inviata. Riprovare")
                EndIf


La funzione _INetSmtpMail se non sbaglio è la funzione di autoit che permette l'invio di mail specificando il server di posta in uscita, giusto? Il banalissimo codice che vedete sopra dovrebbe inviare una mail e se l'invio avviene con successo viene un messaggio di conferma, sennò appare un messaggio che dice che l'invio della mail è fallito. Ho provato centinaia di volte questo codice ma non mi invia l'email. è qualche antivirus o firewall che blocca l'invio? è il codice errato?
Questo codice mi servirebbe per una piccola applicazione che sto facendo (non pensate male). Ringrazio in anticipo tutti coloro che risponderanno.
 
Top
lknokl
CAT_IMG Posted on 26/5/2008, 09:02     +1   -1




io questa funzione l'ho provata e funziona (scusate il gioco di parole)
i problemi possono essere 3 in quanto e molto simile a mandare le mail con telnet:
1-dipende se il server di posta in uscita e davvero il tuo (quello del tuo provider se non hai un server privato), se non e il tuo dovrebbe bloccarti le mail in uscita....
2-il server che stai provando (è rarissimo) non utilizza come porta smtp la 25 (ripeto molto raro)
3-il firewall davvero sta bloccando qualcosa Oo
 
Top
Crazy_Mauro
CAT_IMG Posted on 26/5/2008, 12:54     +1   -1




CITAZIONE (lknokl @ 26/5/2008, 10:02)
io questa funzione l'ho provata e funziona (scusate il gioco di parole)
i problemi possono essere 3 in quanto e molto simile a mandare le mail con telnet:
1-dipende se il server di posta in uscita e davvero il tuo (quello del tuo provider se non hai un server privato), se non e il tuo dovrebbe bloccarti le mail in uscita....
2-il server che stai provando (è rarissimo) non utilizza come porta smtp la 25 (ripeto molto raro)
3-il firewall davvero sta bloccando qualcosa Oo

è il problema numeo 1. Io non so il server di posta in uscita del mio provider, perchè il mio non è un comune provider tipo alice o tiscali. Il mio prov è MPC.
 
Top
Metal Gabber
CAT_IMG Posted on 26/5/2008, 16:25     +1   -1




Mi sa che ti tocca chiedere all'assistenza del tuo provider, oppure guardare sul loro sito
 
Top
MatteoJug
CAT_IMG Posted on 26/5/2008, 17:38     +1   -1




Anchio molto tempo fa ho incontrato questo problema, pero sono riuscito a risolverlo facendomi una funzione che consentiva l'invio dell'email atraverso il protocollo TCP.
la funzione:
CODICE
Func _SendMail($user,$pass,$server,$from,$to,$port=25,$obj="OGGETTO",$msg="MESSAGGIO",$visibile=False)
       $msg=StringReplace($msg,@CRLF & "." & @CRLF,@CRLF & "," & @CRLF)
       $limit_time=15000
       if $visibile=True Then SplashTextOn("Send Email","Inizio Connessione...",200,100)
       TCPStartup()
       $main_sock=TCPConnect(TCPNameToIP($server),$port)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Richiesta al server",200,100)
       TCPSend($main_sock,"HELO EMAIL" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Login in corso...",200,100)
       TCPSend($main_sock,"AUTH LOGIN" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,$user & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       TCPSend($main_sock,$pass & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Invio email in corso...",200,100)
       TCPSend($main_sock,"MAIL FROM:<" & $from & ">" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,"RCPT TO:<" & $to & ">" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       TCPSend($main_sock,"DATA" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,"SUBJECT:" & $obj & @CRLF)
       TCPSend($main_sock,"" & @CRLF)
       TCPSend($main_sock,$msg & @CRLF & "." & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashOff()
       TCPCloseSocket($main_sock)
       TCPShutdown()
       Return $rec
EndFunc

L'ho ritestata ora ed ha funzionato, però una cosa importantissima:
L'username e la password DEVONO essere in Base64, in quanto senno il server non li riconosce.
Ditemi se non vi funziona.
 
Top
lknokl
CAT_IMG Posted on 26/5/2008, 19:31     +1   -1




fantastico ^^
 
Top
Crazy_Mauro
CAT_IMG Posted on 26/5/2008, 22:46     +1   -1




CITAZIONE (MatteoJug @ 26/5/2008, 18:38)
Anchio molto tempo fa ho incontrato questo problema, pero sono riuscito a risolverlo facendomi una funzione che consentiva l'invio dell'email atraverso il protocollo TCP.
la funzione:
CODICE
Func _SendMail($user,$pass,$server,$from,$to,$port=25,$obj="OGGETTO",$msg="MESSAGGIO",$visibile=False)
       $msg=StringReplace($msg,@CRLF & "." & @CRLF,@CRLF & "," & @CRLF)
       $limit_time=15000
       if $visibile=True Then SplashTextOn("Send Email","Inizio Connessione...",200,100)
       TCPStartup()
       $main_sock=TCPConnect(TCPNameToIP($server),$port)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Richiesta al server",200,100)
       TCPSend($main_sock,"HELO EMAIL" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Login in corso...",200,100)
       TCPSend($main_sock,"AUTH LOGIN" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,$user & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       TCPSend($main_sock,$pass & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Invio email in corso...",200,100)
       TCPSend($main_sock,"MAIL FROM:<" & $from & ">" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,"RCPT TO:<" & $to & ">" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       TCPSend($main_sock,"DATA" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,"SUBJECT:" & $obj & @CRLF)
       TCPSend($main_sock,"" & @CRLF)
       TCPSend($main_sock,$msg & @CRLF & "." & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashOff()
       TCPCloseSocket($main_sock)
       TCPShutdown()
       Return $rec
EndFunc

L'ho ritestata ora ed ha funzionato, però una cosa importantissima:
L'username e la password DEVONO essere in Base64, in quanto senno il server non li riconosce.
Ditemi se non vi funziona.

Funziona.
Grazie era quello che mi serviva :D
 
Top
TheTruth1392
CAT_IMG Posted on 26/6/2008, 07:11     +1   -1




scusata ma il mio indirizzo mail dove lo devo inserire??
 
Top
~ Sbarabau ~
CAT_IMG Posted on 21/6/2009, 16:37     +1   -1




Scusate se uppo il topic, ma come funziona quel codice?
E se io volessi mettere un file in allegato, come dovrei fare?

Edited by ~ Sbarabau ~ - 21/6/2009, 17:57
 
Top
MatteoJug
CAT_IMG Posted on 21/6/2009, 17:52     +1   -1




QUesto è solo per inviare messaggi, non allegati...
 
Top
~ Sbarabau ~
CAT_IMG Posted on 22/6/2009, 10:25     +1   -1




Ah ok!
 
Top
your_shadow
CAT_IMG Posted on 25/6/2009, 17:30     +1   -1




CITAZIONE (MatteoJug @ 26/5/2008, 18:38)
Anchio molto tempo fa ho incontrato questo problema, pero sono riuscito a risolverlo facendomi una funzione che consentiva l'invio dell'email atraverso il protocollo TCP.
la funzione:
CODICE
Func _SendMail($user,$pass,$server,$from,$to,$port=25,$obj="OGGETTO",$msg="MESSAGGIO",$visibile=False)
       $msg=StringReplace($msg,@CRLF & "." & @CRLF,@CRLF & "," & @CRLF)
       $limit_time=15000
       if $visibile=True Then SplashTextOn("Send Email","Inizio Connessione...",200,100)
       TCPStartup()
       $main_sock=TCPConnect(TCPNameToIP($server),$port)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Richiesta al server",200,100)
       TCPSend($main_sock,"HELO EMAIL" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Login in corso...",200,100)
       TCPSend($main_sock,"AUTH LOGIN" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,$user & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       TCPSend($main_sock,$pass & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashTextOn("Send Email","Connessione stabilita" & @CRLF & "Invio email in corso...",200,100)
       TCPSend($main_sock,"MAIL FROM:<" & $from & ">" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,"RCPT TO:<" & $to & ">" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       TCPSend($main_sock,"DATA" & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       TCPSend($main_sock,"SUBJECT:" & $obj & @CRLF)
       TCPSend($main_sock,"" & @CRLF)
       TCPSend($main_sock,$msg & @CRLF & "." & @CRLF)
       $timer=TimerInit()
       while TimerDiff($timer)<$limit_time
               $rec=TCPRecv($main_sock,1000)
               if $rec<>"" then ExitLoop
       WEnd
       $timer=0
       if $rec="" then Return SetError(1,0,0)
       if $visibile=True Then SplashOff()
       TCPCloseSocket($main_sock)
       TCPShutdown()
       Return $rec
EndFunc

L'ho ritestata ora ed ha funzionato, però una cosa importantissima:
L'username e la password DEVONO essere in Base64, in quanto senno il server non li riconosce.
Ditemi se non vi funziona.

user e password devono essere quelli veri??? e per base64 cosa intendi?
 
Top
MatteoJug
CAT_IMG Posted on 26/6/2009, 08:13     +1   -1




User e password devono essere quelli veri logicamente XD
In base64 intendo il sistema di criptaggio...
 
Top
12 replies since 25/5/2008, 19:58   966 views
  Share