Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Sending HTML Mail using MAPI


Message #1 by "L D" <ludsouza@h...> on Sat, 4 May 2002 17:59:55
I am trying to send mail using mapi through ASP. I am able to do so. But 
when i try to send html mail, all the tags are rendered as text. I need to 
be able to send HTML mail using MAPI because my clients have restrictions 
on the smtp server. Besides when I try to send mail using CDO.Message I 
get the 'transport failed to connect to the server' error for emails 
across domains in the intranet as well as for external emails.
I have been reading cdo live and got the idea that I might need to use the 
CDO html rendering library. Also I would be able to access the cdohtml.dll 
via OWA. But could u help me with the coding part? How would the code 
change? Currently I use the following code:

Function Mail(strTo, strFrom, strSubject, strBody)

Dim objSess, objFBMess, objRecips, bstrProfileInfo, 
cStrServer,cStrMailbox, objRenderApp   ' Our CDO object
		
cStrServer        = ExchangeServerName
cStrMailbox       = strFrom
	
bstrProfileInfo = cStrServer & vbLf & cStrMailbox 

Set objSess = CreateObject("MAPI.Session")		
objSess.Logon "", "", False, True, 0, True, bstrProfileInfo
	
Set objFBMess = objSess.Outbox.Messages.Add
objFBMess.Subject = strSubject
objFBMess.Text = strBody
	
Set objRecips = objFBMess.Recipients
Set objRecips = objFBMess.Recipients.Add
objRecips.Add (strTo)	
objRecips.Resolve
	
objFBMess.Send
objSess.Logoff
	
End Function

Hope someone can help me out.

Message #2 by "Aaron Fleming" <aaronf@w...> on Tue, 7 May 2002 11:33:35 -0400
Add this:

    objFBMess.BodyFormat=0
    objFBMess.MailFormat=0

Where 0 is HTML

Cheers,
Aaron

-----Original Message-----
From: L D [mailto:ludsouza@h...] 
Sent: May 4, 2002 2:00 PM
To: ASP CDO
Subject: [asp_cdo] Sending HTML Mail using MAPI


I am trying to send mail using mapi through ASP. I am able to do so. But

when i try to send html mail, all the tags are rendered as text. I need
to 
be able to send HTML mail using MAPI because my clients have
restrictions 
on the smtp server. Besides when I try to send mail using CDO.Message I 
get the 'transport failed to connect to the server' error for emails 
across domains in the intranet as well as for external emails. I have
been reading cdo live and got the idea that I might need to use the 
CDO html rendering library. Also I would be able to access the
cdohtml.dll 
via OWA. But could u help me with the coding part? How would the code 
change? Currently I use the following code:

Function Mail(strTo, strFrom, strSubject, strBody)

Dim objSess, objFBMess, objRecips, bstrProfileInfo, 
cStrServer,cStrMailbox, objRenderApp   ' Our CDO object
		
cStrServer        = ExchangeServerName
cStrMailbox       = strFrom
	
bstrProfileInfo = cStrServer & vbLf & cStrMailbox 

Set objSess = CreateObject("MAPI.Session")		
objSess.Logon "", "", False, True, 0, True, bstrProfileInfo
	
Set objFBMess = objSess.Outbox.Messages.Add
objFBMess.Subject = strSubject
objFBMess.Text = strBody
	
Set objRecips = objFBMess.Recipients
Set objRecips = objFBMess.Recipients.Add
objRecips.Add (strTo)	
objRecips.Resolve
	
objFBMess.Send
objSess.Logoff
	
End Function

Hope someone can help me out.



  Return to Index