Re : vba et thunderbird
Bonjour,
Je te joins mon code :
Sub CDO_Mail_Small_Text()
Dim iMsg As Object
Dim iConf As Object
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = X ' selon parametrage boite mail
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxxxxxxxx" ' selon parametrage boite mail
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = XX ' selon parametrage boite mail
.Update
End With
On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _ ' si une adresse mail est saisie en colonne b mais moi je saisie en dessous donc cette ligne ne sert pas
LCase(Cells(cell.Row, "L").Value) = "yes" _ ' si en colonne L t'as "yes"
And LCase(Cells(cell.Row, "M").Value) <> "send" And _ ' en M t'as envoyé (ça evite de l'envoyer à chaque fois"
LCase(Cells(cell.Row, "A").Select) And _ ' il copie la colonne A
LCase(Cells(cell.Row, "I").Select) And _ ' il copie la colonne I
LCase(Cells(cell.Row, "M").Select) Then ' il copie la colonne M
-> ça sert pour le corps du mail, il renvoie ces éléments
Set iMsg = CreateObject("CDO.Message")
With iMsg
Set .Configuration = iConf
.To = "Adresse mail destinaire"
.from = "ton adresse mail"
.Subject = "Rappel"
.TextBody = "Bonjour," & vbNewLine & vbNewLine & _
"Le contrat suivant arrive à échéance :" & vbNewLine _
& "- " & Cells(cell.Row, "A").Value & " le " & Cells(cell.Row, "I").Value & " - Modalité de résiliation : " & Cells(cell.Row, "M").Value
.Send
End With
Set iMsg = Nothing
Cells(cell.Row, "M").Value = "send"
End If
Next cell
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
cleanup:
Set iMsg = Nothing
Application.ScreenUpdating = True
End Sub
Avec ce code t'as un mail par contrat dépassé avec les infos contenues en colonne A, M et I.
voilà