Blocage envoi email vbs en CDO
Bonjour,
J'ai un petit scrit vbs qui permet d’envoyer des emails (voir code ci-dessous). Tout fonctionne sur mon poste perso "à la maison". Mais si je veux faire tourner le même script sur mon poste au boulot ben ça bloque avec ce message d'erreur Le transport a échoué dans sa connexion au serveur
Mais je sais pas si c'est le proxy ou autre qui bloque, si vous avez un avis sur sujet? Parce que je garde exactement la même connexion au compte.
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 29 30 31
| Set objMsg = CreateObject("CDO.Message")
Set msgConf = CreateObject("CDO.Configuration")
'Server Configuration
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") ="465"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "******@gmail.com" 'type your mail id
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*******" 'Type your acccount Password
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = "true"
msgConf.Fields.Update
'End With
objMsg.To = "******@gmail.com " ' type to mail id
objMsg.From = "*******@gmail.com " 'type from mail id
objMsg.Subject = "Test mail"
objMsg.HTMLBody = "Test Mail for users"
'objMsg.AddAttachment "C:\Users\Username\Pictures\Image.jpg"
objMsg.AddAttachment filepath ' Attachement object
objMsg.Sender = "Mr. Name"
Set objMsg.Configuration = msgConf
' Send
objMsg.Send
Msgbox("Email Sent Successfully")
' Clear
Set objMsg = nothing
Set msgConf = nothing |