Macro pour envoi Email par Gmail

  • Initiateur de la discussion Initiateur de la discussion Snoop
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Snoop

XLDnaute Occasionnel
Bonjour tout le Monde,

J'ai trouvé une Macro pour envoyer des emails par gmail avec la methode CDO (mon navigateur intenet est Mozilla)

--> la macro ne semble pas fonctionner, j'ai une erreur, cela semble être un problème du réseau qui me demande un logging et mot de passe à chaq connexion Internet
--> erreur exécution 2147220973 (80040213)
-----> si quelqu'un à une idée car sinon je suis obliger de me déconnecter du proxy et du réseau d'où je travaille pour que cela fonctionne !!!

La macro :
'If you have a GMail account then you can try this example to use the GMail smtp server
'The example will send a small text message
'You must change four code lines before you can test the code

'.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Full GMail mail address"
'.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "GMail password"

'Use your own mail address to test the code in this line
'.To = "Mail address receiver"

'Change YourName to the From name you want to use
'.From = """YourName"" <Reply@something.nl>"

'If you get this error : The transport failed to connect to the server
'then try to change the SMTP port from 25 to 465

Sub CDO_Mail_Small_Text_2()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Dim Flds As Variant

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx@xxx"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxx0"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Update
End With

strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"

With iMsg
Set .Configuration = iConf
.To = "xxx"
.CC = ""
.BCC = ""
' Note: The reply address is not working if you use this Gmail example
' It will use your Gmail address automatic. But you can add this line
' to change the reply address .ReplyTo = "Reply@something.nl"
.From = """xxx"" <xxx>"
.Subject = "Important message"
.TextBody = strbody
'.AddAttachment "D:/xxz.zip" 'Pour mettre un fichier
.Send
End With

End Sub


MERCI pour votre aide !!
 
Re : Macro pour envoi Email par Gmail

Bonjour,

Je suis en train de continuer de chercher, et je pense que cela provient du LDAP account sous Internet, mais je ne sais pas comment intégrer le logging et mot de passe à l'intérieur de la macro.

Si quelqu'un à une idée simple !!

Merci pour tout
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
Réponses
1
Affichages
585
Réponses
17
Affichages
2 K
Réponses
4
Affichages
3 K
Retour