Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Embed images in emails
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01237212
Message ID:
01237328
Vues:
15
Wouldn't this "CdoReferenceTypeName" constant cause an error in VFP?

>Thanks Sergey !
>
>I've just found the solution in this russian forum, using the "AddRelatedBodyPart" function:
>http://www.sql.ru/forum/actualthread.aspx?tid=79485
>
>That's for VB, but worked like a charm for VFP too.
>
>Below is the working code:
>
>
>
LPARAMETERS tcDestino, tcAssunto, tcHTML, tcArquivo, tcPicture
>
>LOCAL lcSchema, loConfig, loMsg, loError, lcErr
>
>  lcSchema = "http://schemas.microsoft.com/cdo/configuration/"
>
>  LOCAL loConfig as "CDO.Configuration"
>  loConfig = CREATEOBJECT("CDO.Configuration")
>
>  WITH loConfig.FIELDS
>
>    .ITEM(lcSchema + "smtpserver") ="smtp.uol.com.br" && place your smtp here
>    .ITEM(lcSchema + "smtpserverport") = "25"
>    .ITEM(lcSchema + "sendusing") = 2
>    .ITEM(lcSchema + "smtpauthenticate") = .T.
>    .ITEM(lcSchema + "smtpusessl") = .F.
>    .ITEM(lcSchema + "sendusername") = "login" && login
>    .ITEM(lcSchema + "sendpassword") = "password" && your password
>
>    .UPDATE
>
>  ENDWITH
>
>
>  LOCAL loMsg as "CDO.Message"
>  loMsg = CREATEOBJECT ("CDO.Message")
>
>  WITH loMsg
>
>    .Configuration = loConfig
>    .FROM = "Foxbrasil <foxbrasil@superfox.com.br>"
>    .TO = tcDestino
>    .Subject = tcAssunto
>
>	IF VARTYPE(tcArquivo) = "C" AND FILE(tcArquivo)
>		loMsg.AddAttachment(tcArquivo) && Must be a valid file
>	ENDIF
>	
>	#DEFINE CdoReferenceTypeName  1
>	loMsg.AddRelatedBodyPart(lcArquivo, "pic", CdoReferenceTypeName)
>	
>*    .TextBody = "Here pur text"
>
>
>* This is a test HTML showing how to use the emebedded image
>    tcHTML = ="<html><img src='pic'></html>"
>
>
>    .HTMLBody = tcHTML     .Send()
>
>  ENDWITH
>
>
>
>Regards
>
>Cesar
>
>
>
>
>
>
>>It can be done with CDO 2000 which has CreateMHTMLBody() method.
>>
>>>I've been using CDOSys to send emails for some years, and now I'd like to add several images in the HTML code, but I'm having some troubles.
>>>
>>>I know I can publish the pictures on my web site and then just use an absolute link to them in the html code, like this, i.e., img src="http://mydomain.com/images/image.gif"
>>>
>>>But obviously this is not the best way to do, since for this case some pictures will be specific to each receiver.
>>>
>>>Can someone tell me how can I embed the image in the email body ? Preferrably, using CDOSYS.
>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform