Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text RTF in a email
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01398073
Message ID:
01398144
Views:
85
I do'nt know really....:-)

This is the sendmail() (ippstuf )
LPARAMETERS lcMailServer, lcSenderName, lcSenderEmail, ;
             lcRecipient, lcCCList, lcSubject, lcMessage, ;
             lcAttachment, lcBCCList,lcContentType,lcAlternateText,lcLogFile
LOCAL lcError, llResult, lcUsername, lcPassword

lcMailserver=TRIM(IIF(type("lcMailserver")="C",lcMailserver,THIS.cMailServer))
lcSendername=TRIM(IIF(type("lcSendername")="C",lcSendername,THIS.cSenderName))
lcSenderEmail=TRIM(IIF(type("lcSenderEmail")="C",lcSenderEmail,THIS.cSenderEmail))
lcRecipient=TRIM(IIF(type("lcRecipient")="C",lcRecipient,THIS.cRecipient))
lcCCList=TRIM(IIF(type("lcCCList")="C",lcCCList,THIS.cCCList))
lcBCCList=TRIM(IIF(type("lcBCCList")="C",lcBCCList,THIS.cBCCList))

lcSubject=IIF(type("lcSubject")="C",lcSubject,THIS.cSubject)
lcMessage=IIF(type("lcMessage")="C",lcMessage,THIS.cMessage)
lcAttachment=TRIM(IIF(type("lcAttachment")="C",lcAttachment,THIS.cAttachment))
lcContentType=TRIM(IIF(type("lcContentType")="C",lcContentType,THIS.cContentType))
lcLogFile = TRIM(IIF(TYPE("lcLogFile")="C",lcLogFile,this.cLogFile))

*** NOte: this value is matched to the boundary in wwipstuff.dll
***       DON'T CHANGE!
lcContentBoundary = "NextPart_000_0025_01BDBAA5.86C80EB0"

*** Add some common required extra headers
IF !EMPTY(this.cPriority) AND ATC("Importance:",this.cExtraHeaders) < 1
   this.cExtraheaders = this.cExtraHeaders + ;
      "Importance:" + this.cPriority + CHR(13) + CHR(10)
ENDIF

IF THIS.lReturnReceipt AND ATC("Return-Receipt-To:",this.cExtraHeaders) < 1
   this.cExtraHeaders = this.cExtraHeaders + ;
      "Return-Receipt-To: " + this.cSenderemail + CHR(13)+CHR(10)
ENDIF

IF EMPTY(lcAlternateText)
	lcAlternateText = this.cMessageAlternate
ENDIF	
IF !EMPTY(lcAlternateText)
	*** More info: http://www.wilsonweb.com/wmt5/html-email-multi.htm
	lcMessage = "--" + lcContentBoundary + CRLF + ;
				"Content-Type: " + this.cContentType + CRLF +CRLF +;
				lcMessage  + CRLF +CRLF
	
	lcMessage = lcMessage + ;
				"--" + lcContentBoundary + CRLF + ;
				"Content-Type: " + this.cContentTypealternate + CRLF +CRLF +;
				lcAlternateText  + CRLF
	
	lcContenttype = [multipart/alternative;boundary="] + lcContentBoundary + ["]
ENDIF

lcError=SPACE(513)

DECLARE integer SendMail ;
   IN (THIS.cDLLPath) ;
   STRING cFrom, ;
   STRING cFromName, ;
   STRING cTo, ;
   STRING cCC, ;
   STRING cBCC, ;
   STRING cSubject, ;
   STRING cMessage, ;
   STRING cAttachment,; 
   STRING cMailHost,;
   STRING @cError,;
   STRING cContentType,;
   INTEGER nPort,;
   STRING cExtraHeaders,;
   STRING cUsername,;
   STRING cPassword,;
   STRING cLogFile

*** Base64 Encode username and password
#IF wwVFPVersion < 7
	lcUsername = IIF(!EMPTY(this.cUsername),this.Base64encode(TRIM(THIS.cUsername)),"" )
	lcpassword = IIF(!EMPTY(this.cPassword),this.Base64encode(TRIM(THIS.cPassword)),"" )
#ELSE
	lcUsername = IIF(!EMPTY(this.cUsername),STRCONV(TRIM(THIS.cUsername),13),"")
	lcpassword = IIF(!EMPTY(this.cPassword),STRCONV(TRIM(This.cPassword),13),"")
#ENDIF

llResult=IIF(SendMail(lcSenderEmail, lcSenderName,;
            lcRecipient, lcCCList,lcBCCList,;
            lcSubject, lcMessage, lcAttachment,;
            lcMailServer,@lcError,lcContentType,THIS.nSMTPPort,THIS.cExtraHeaders,;
            lcUsername, lcPassword,lcLogFile)=1,.T.,.F.)

IF !llResult
   THIS.cErrorMsg = TRIM(CHRTRANC(lcError,CHR(0),""))
ELSE
   THIS.cErrorMsg = ""
ENDIF
               
RETURN llResult

************************************************************************
* wwIPStuff :: SendMail
*********************************
***  Function: Sends SMTP mail. Call waits for completion and returns
***            result code
***    Assume: Message Text can't be more than 64k. 
***      Pass: tcMailServer    -  IP Address or Domain Name
***            tcSenderName    -  Sender Display Name (Rick Strahl)
***            tcSenderMailAddress Sender's full email address (rstrahl@west-wind.com)
***            tcRecipientList -  Recipients separated by commas (ben@test.com, jim@test.com)
***            tcCCList        -  List of CCs separated by commas
***            tcSubject       -  Subject Header 
***            tcMessage       -  Message Body 
***            tcAttachement   -  File Attachement (1 only)
***    Return: .T. or .F.
************************************************************************
>If you put HTML in a text body it'll be treated as text.
>I'm not familiar with ippstuff class. Does it support an HTML body?
>
>You can easily send HTML email with CDO 2000 http://www.berezniker.com/content/pages/visual-foxpro/send-email-cdo-2000
>
>>I use ippstuff class
>>
>>I do THIS.cMsgTextBody
>>
>>THIS.cMsgTextBody include html code...
>>
>>I think that the problem is around this code ?
>>
>>
>>
>>TEXT To This.cPageHtm NOSHOW TEXTMERGE
>><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>><html xmlns="http://www.w3.org/1999/xhtml">
>><head>
>><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>><title>Titre du message ?</title>
>></head>
>>
>><body>
>><p><img src="http://www.Amline.be//images/LOGOAMline1.jpg" width="212" height="157" alt="Logo Amline" longdesc="http://www.amline.be" /></p>
>><<THIS.cMsgTextBody>>
>><<This.cSigneMessageHtm>>
>></body>
>></html>
>>ENDTEXT
>>
>>
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform