Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send e-mail as HTML

Status
Not open for further replies.

01310564

Programmer
Oct 9, 2003
96
0
0
GB
Hi

I'm using MAPI to send an e-mail and that works fine problem is that it is in plain text and needs to be in HTML.

i Have tried to set MAPIMessages.MsgType = "html" but when i open it in Outlook i get an error


"The custom form could not be opened. Outlook will use an Outlook form instead. The object could not be found."


Hugh
 
One way is to send the file as an attachment by converting the text to html format and sending it:

Open <path and filename> for Output as #1
---your text here---
Close #1

Then send the file (whatever you named it) as an attachment.

Or I guess you could just send it as plain text like usual, but put HTML tags around it:

<HTML>
--text---
</HTML>

I hope this helps.

Travis
 
Travis,

I obvosly didn't explain this well enough.

I'm not tring attach a file all I want to do is to have a hyperlink in the e-mail that when some one clicks it they are taken to a web site.

In order to achive this i need to send the e-mail in HTML format but when i'm using MAPI it sends it in plain text and i was wondering if there is any way of changing this.

Hugh
 
Ok, well this should work:

Where you want the link to be, put:

<a href=&quot;website path&quot;>Website Name</a>

That should create a link, whether or not you send it as html.

Travis
 
This is the code that I'm using

Me.MAPISession1.SignOn
Me.MAPIMessages1.SessionID = Me.MAPISession1.SessionID
Me.MAPIMessages1.Compose
Me.MAPIMessages1.RecipAddress = &quot;smtp:&quot; & rs!email
Me.MAPIMessages1.RecipDisplayName = &quot;Help Desk&quot;
Me.MAPIMessages1.MsgSubject = data.Recordset!breif
Me.MAPIMessages1.MsgNoteText = &quot;Please go to <a href='website'>This Site</a>&quot;
Me.MAPIMessages1.Send False
Me.MAPISession1.SignOff



and it ain't working!

Have you got any more ideas.

Cheers,

Hugh
 
you cant with MAPI, theres is a second MAPI released that supports HTML, but I cant help you, make further search at MSDN or google.

regards,

--
Luis MX
 
I am sending an email using MAPI, not specifying any email type, and sending a link just with and it works fine(shows up blue, works as a link should). Have you tried just putting in the website address?
 
vanvb

but your reader its converting that text to a link, what if you send it to other mail services ? like hotmail.

regards.

--
Luis MX
 
Good point. I tested it in Yahoo and it worked fine. I don't have a hotmail account to test. You're right that the reader is converting it though.

01310564, do you have any idea what people will be viewing this in, or is it for the general public?
 
Two ways to create an HTML e-mail:

1. Automate Outlook to create the MailItem. Set its HTMLBody property to a HTML formatted string.

2. Use a SMTP control rather than MAPI. CDONTS, CDO for Windows 2000 or CDO for Exchange 2000 depending on your development platform.

Paul Bent
Northwind IT Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top