Envoi mail avec importance
Le
Thierry
Bonjour,
J'ai mis en place une alerte de sauvegare par mail.
J'aimerais perfectionner cela en mettant une importance
haute à ce mail. Mais je coince.
Voici mon code:
' Send by connecting to port 25 of the SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim strMail
Const cdoSendUsingPort = 2
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
strBody = "Voici le corps du mail à envoyer."
' Set the CDOSYS configuration fields to use port 25 on
the SMTP server.
With Flds
.Item
("http://schemas.microsoft.com/cdo/co...sing"
) = cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item
("http://schemas.microsoft.com/cdo/co...smtpserver
") = "ADDR_SMTP_SERVER"
.Item
("http://schemas.microsoft.com/cdo/co...smtpconnec
tiontimeout") = 10
.Update
End With
' Build HTML for message body.
strMail = "<HTML>"
strMail = strMail & "<HEAD>"
strMail = strMail & "<BODY>"
strMail = strMail & "<br><p align=center><b>Sauvegarde
Outlook AGermain.</b></p>"
strMail = strMail & "<br>"
strMail = strMail & "<br>Le " & Now() & " :"
strMail = strMail & "<br><br><blockquote><b>" & strBody
& "</b></blockquote>"
strMail = strMail & "<br><br><blockquote>Le Service
Informatique.</blockquote>"
strMail = strMail & "</BODY>"
strMail = strMail & "</HTML>"
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "pseudo@domaine.fr"
.From = "Alerte@domaine.fr"
.Subject = "Envoi mail via un script VBS"
.HTMLBody = strMail
.Importance = 2
.Send
End With
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
MsgBox "Mail Sent!"
Lorsque je mets .Importance = 2 ou 0 ou1, j'ai une erreur
m'indiquant que l'objet ne gère pas la propriété
importance !!!
Avez vous déjà rencontré ce pb ou des idées?
Merci par avance,
Amicalement
Thierry
J'ai mis en place une alerte de sauvegare par mail.
J'aimerais perfectionner cela en mettant une importance
haute à ce mail. Mais je coince.
Voici mon code:
' Send by connecting to port 25 of the SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim strMail
Const cdoSendUsingPort = 2
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
strBody = "Voici le corps du mail à envoyer."
' Set the CDOSYS configuration fields to use port 25 on
the SMTP server.
With Flds
.Item
("http://schemas.microsoft.com/cdo/co...sing"
) = cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item
("http://schemas.microsoft.com/cdo/co...smtpserver
") = "ADDR_SMTP_SERVER"
.Item
("http://schemas.microsoft.com/cdo/co...smtpconnec
tiontimeout") = 10
.Update
End With
' Build HTML for message body.
strMail = "<HTML>"
strMail = strMail & "<HEAD>"
strMail = strMail & "<BODY>"
strMail = strMail & "<br><p align=center><b>Sauvegarde
Outlook AGermain.</b></p>"
strMail = strMail & "<br>"
strMail = strMail & "<br>Le " & Now() & " :"
strMail = strMail & "<br><br><blockquote><b>" & strBody
& "</b></blockquote>"
strMail = strMail & "<br><br><blockquote>Le Service
Informatique.</blockquote>"
strMail = strMail & "</BODY>"
strMail = strMail & "</HTML>"
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "pseudo@domaine.fr"
.From = "Alerte@domaine.fr"
.Subject = "Envoi mail via un script VBS"
.HTMLBody = strMail
.Importance = 2
.Send
End With
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
MsgBox "Mail Sent!"
Lorsque je mets .Importance = 2 ou 0 ou1, j'ai une erreur
m'indiquant que l'objet ne gère pas la propriété
importance !!!
Avez vous déjà rencontré ce pb ou des idées?
Merci par avance,
Amicalement
Thierry

Poser une question


En fonction de la version cdo utilisée, votre script pourrait marcher.
Pour vous aider, il vous faut modifer votre code en rajoutant les lignes
suivantes
avant .send
set fld = .Fields
with fld
.Item("urn:schemas:httpmail:importance") = 2
' .Item("urn:schemas:mailheader:X-Priority") = 3 ' avoir
selon les clients
' .Item("urn:schemas:mailheader:X-MSMail-Priority") = 1' idem
.Update
end with
Bonne chance
Philippe freddi
J'ai essayé les trois solutions.
Cela fonctionne bien en envoi de mail.
Mais hélàs, cela ne me met pas de niveau d'importance,
j'ai essayé les valeurs saisies, puis avec la valeur 4 par
exemple pour le premier.
Il me semble que c'est:
0 = Normal
1 = Medium
2 = Hight
Je peux me tromper, mais merci tout de même.
Amicalement
Thierry
Bon week-end
Quelle version de l'OS et l'OS ?
Quelle version du client ?
eventuellement du serveur smtp ?
Je l'ai testé sous xp avec les cdo de 2000, serveur smtp unix et client
outlook 2003 sans problème.
Philippe
Je suis sous Win2k Pro avec le cdont de win2kPro
Serveur smtp Linux Debian
Client outlook XP
Amicalement
Thierry
cela devrait fonctionner! je n'ai plus officeXP depuis trop longtemps ...
Regarder dans l'entête du message reçu si les valeurs changent.
Pour ce faire, faites apparaitre le message dans sa propre fenêtre puis
cliquez sur options dans le menu affichage et examinez l'entête internet, en
fonction des valeurs, cela devrait changer.
Bonne chance
Philippe