Comment savoir le nom de mon serveur SMTP de ma connexion en cours ?
:salut:
je suis entrain de faire un VBscript en utilisant l'utilitaire Blat
Citation:
Blat est un utilitaire en ligne de commande qui envoie un email en utilisant le protocole SMTP.
Donc je cherche un moyen ou un Truc ou bien un service en ligne genre comment savoir le nom de mon serveur SMTP de ma connexion en cours ? pour ne pas éditer mon script chaque fois que je change de FAI exemple quand je me connecte depuis un espace publique.
Bon à present j'ai arrivé à cette solution mais elle me satisfait pas beaucoup car je dois savoir tout les serveurs SMTP et de les mettre dans un tablau ou je dois les parcourir obligatoirement une par une dans une boucle For Next.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Function MailBlat()
Dim Recipient, cc, mailhost, sender, subject, strCommand,AttDoc,AttDocZ
Set objShell = CreateObject("Wscript.Shell")
Listsmtp=array("smtp.FAI1.com","smtp.FAI2.com","smtp.FAI3.com","smtp.FAI4.com","smtp.FAI5.com")
For X=LBound(Listsmtp) to UBound(Listsmtp)
ComputerName = objShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Recipient = "mon-e-mail@doMailBlate.fr"
cc = "autre-e-mail@doMailBlate.com"
mailhost = Listsmtp(X)
sender = ComputerName&"@"&ComputerName&".com"
subject = "Resultat de mailblat " & Date()
AttDoc = "c:\TestVBscript\iplog.htm"
AttDocZ = "C:\Crypt&Decrypt\MailBlat\mailblat.rar"
strCommand = "%comspec% /c blat.exe -to " & Chr(34) & recipient & Chr(34) & ""
strCommand = strCommand & " -log ""Blat.log"""
strCommand = strCommand & " -cc " & Chr(34) & cc & Chr(34) & ""
strCommand = strCommand & " -server " & Chr(34) & mailhost & Chr(34) & ""
strCommand = strCommand & " -subject " & Chr(34) & subject & Chr(34) & ""
strCommand = strCommand & " -body " & Chr(34) & "Ceci est le Corps du message" & Chr(34) & ""
strCommand = strCommand & " -bodyF " & chr(34) & AttDoc & chr(34) & ""
strCommand = strCommand & " -attach " & Chr(34) & AttDocZ & Chr(34) & ""
strCommand = strCommand & " -f " & Chr(34) & sender & Chr(34) & ""
strCommand = strCommand & " -q"
Result = objShell.Run(strCommand,0,True)
Next
MsgBox "Message Envoyé !",64,"MailBlat"
End Function
MailBlat |
J'ai pensé aussi pour contourner ce problème de SMTP en utilisant cette méthode décrite ici et qu'elle n'est pas encore résolue :calim2: :roll:
Et non, çà ne marche pas avec tout le monde...
Je passe par Nordnet et la réponse est "www.." C'est bien dommage !