Envoie email

Contenu du snippet

Ok alors, ce code est tout petit je sais, mais en fait si je le poste ici c'est parceque je me dis qu'il sera plus visiter qu'une simple question sur un forum. En fait, il me manque quelque chose, tous marche très bien il m'ouvre bien un nouveau mail avec tout ce que je lui demande de me mettre, mais je voudrais qu'il puisse aussi l'envoyer automatiquement (ne pas avoir a appuyer sur le boutton "Envoyer") et aussi pouvoir y associé un "fichier joint".

Source / Exemple :


Public Sub SendMail(Optional Address As String, Optional Subject As String, Optional body As String, Optional CC As String, Optional BCC As String)
    Dim strCommand As String
    If Len(Subject) Then strCommand = "&Subject=" & Subject
    If Len(body) Then strCommand = strCommand & "&Body=" & body
    If Len(CC) Then strCommand = strCommand & "&CC=" & CC
    If Len(BCC) Then strCommand = strCommand & "&BCC=" & BCC
    strCommand = "mailto:" & Address & strCommand
    Call ShellExecute(Me.hwnd, "open", strCommand, vbNullString, vbNullString, SW_SHOWNORMAL)

End Sub

Conclusion :


Mercu a tout ceux qui pourrait me faire des remarques constructives.

A voir également