mar. 27 décembre 2011, 13h27
Gregory
atoutfox.public.association
Re: Automatiser le client mail par défaut
> Il reste CDO avec SMTP authentifié, mais galère ...
Non, pas vraiment la galere. Il suffit d'investir un peu de temps
- pour comprendre comment cela marche, et
- de se creer une classe
Depuis que Outlook demande des permissions a l'utilisateur je me suis tourne
vers CDO. Quasiment plus de problemes depuis. Oui, il faut authentifier
Pour Olivier,
Voila une facon de preparer un mail. J'ai teste avec outlook mail et
windows mail en defaut
Les etappes
(1) Preparer le message avec CDO - meme avec des pieces jointes
(2) Sauver le stream du message dans un fichier tmp (.eml)
(3) Lancer le shellexecute sur ce fichier .eml.
Le shellexecute ouvrira le mail
(4) Il faut effacer le fichier tmp (eml) a un certain moment
local objMsg, i, msgStream, tmpFilename
objMsg = CreateObject('CDO.Message')
objMsg.To = 'abc@def.com'
objMsg.subject ='hello'
if( !hmtlMessage )
objMsg.TextBody ='hello there'
else
objMsg.HTMLbody = FileToStr('d:\tmp\pp.htm')
endif
=m.objMsg.AddAttachment('d:\tmp\1.pdf')
for i = 1 to 120
objMsg.To = m.objMsg.To + ";toto"+Transf(m.i)+"@mycompagny.com"
endfor
?objMsg.To
asser false
objMsg.Fields("urn:schemas:mailheader:x-unsent")=1
=m.objMsg.Fields.Update()
msgStream = m.objMsg.GetStream()
tmpFilename = 'd:\tmp\1.eml'
=m.msgStream.SaveToFile(m.tmpFilename )
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, STRING cAction, STRING cFileName, ;
STRING cParams, STRING cDir, INTEGER nShowWin
=ShellExecute(0,"open",m.tmpFilename ,"","",1)
______
Gregory
______
"vh" wrote in message news:jdbvb4$2t3t$1@news.niouzes.net...
Bonjour,
Le ShellExecute est vraiment une solution facile. Quel dommage que cela ne
fonctionne pas avec une pièce jointe !
Il reste CDO avec SMTP authentifié, mais galère ...
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000007783