Zuhair070699
asked on
Send Html mail
Hi,
Is there is a way to send html page using NMSMTP component without using external component?
Thanks,
Is there is a way to send html page using NMSMTP component without using external component?
Thanks,
Hello Zuhair,
Just set the "Content-Type:text/html" header.
Best Regards
Cesario
Just set the "Content-Type:text/html" header.
Best Regards
Cesario
ASKER
Hi,
Thank you all .. I use NMSMTP componant, so where shall I put the header: Content-type: text/html ??
Thank you all .. I use NMSMTP componant, so where shall I put the header: Content-type: text/html ??
Hi Zuhair,
with NMSMTP1 do
begin
FinalHeader.Add('Test');
PostMessage.ToAddress.Add( 'prioux@vi deotron.ca ');
PostMessage.FromAddress := 'prioux@videotron.ca';
PostMessage.Subject := 'Sending html format';
PostMessage.Date := DateToStr(Date);
PostMessage.Body.LoadFromF ile('C:\te st2.html') ;
SubType := mtHtml;
Connect;
SendMail;
Disconnect;
end;
Best Regards
Cesario
with NMSMTP1 do
begin
FinalHeader.Add('Test');
PostMessage.ToAddress.Add(
PostMessage.FromAddress := 'prioux@videotron.ca';
PostMessage.Subject := 'Sending html format';
PostMessage.Date := DateToStr(Date);
PostMessage.Body.LoadFromF
SubType := mtHtml;
Connect;
SendMail;
Disconnect;
end;
Best Regards
Cesario
ASKER
Thanks,
But I still got plain text messsage !
Any idea ?
But I still got plain text messsage !
Any idea ?
Make sure the body of the message has HTML tags:
<HTML>
<BODY>
<P>
Hi, this is an HTML message.
</BODY>
</HTML>
<HTML>
<BODY>
<P>
Hi, this is an HTML message.
</BODY>
</HTML>
ASKER
Still the same problem.. do you test your code ?
Sorry, the HTML code should've included some markup:
<HTML>
<BODY>
<P>
Hi, <u>this</u> is an <b>HTML<b> <i>message<i>.
<hr>
<P align="center">
<font color="silver">End of Message</font>
</BODY>
</HTML>
I use the ICS component suite - all's I gotta do to send HTML mail is add a custom header
Content-type: text/html
then set the body string to my HTML source(above).
To 'debug', you should try to view the source of the message in your mail client to see if it contains the HTML tags. If you're using Outlook Express this should be under File->Properties, if you're using Outlook (Office), then save the message and open the
.msg file in notepad or something.
rondi.
<HTML>
<BODY>
<P>
Hi, <u>this</u> is an <b>HTML<b> <i>message<i>.
<hr>
<P align="center">
<font color="silver">End of Message</font>
</BODY>
</HTML>
I use the ICS component suite - all's I gotta do to send HTML mail is add a custom header
Content-type: text/html
then set the body string to my HTML source(above).
To 'debug', you should try to view the source of the message in your mail client to see if it contains the HTML tags. If you're using Outlook Express this should be under File->Properties, if you're using Outlook (Office), then save the message and open the
.msg file in notepad or something.
rondi.
ASKER
I am really appretiate your help but could you please take a look to my code:
NMSMTP1.Connect;
NMSMTP1.FinalHeader.Add('C ontent-Typ e:text/htm l');
NMSMTP1.EncodeType := uuMime;
NMSMTP1.PostMessage.FromAd dress := 'System';
NMSMTP1.PostMessage.FromNa me := 'System Administrator';
NMSMTP1.PostMessage.ToAddr ess.Clear;
NMSMTP1.PostMessage.ToAddr ess.Add('m y@email.me ');
NMSMTP1.PostMessage.Body.L oadFromFil e('c:\test 2.html');
NMSMTP1.PostMessage.Subjec t := 'title';
If NMSMTP1.Connected then
NMSMTP1.SendMail;
========================== ========== ========== ==========
test2.html file is what you posted:
<HTML>
<BODY>
<P>
Hi, <u>this</u> is an <b>HTML<b> <i>message<i>.
<hr>
<P align="center">
<font color="silver">End of Message</font>
</BODY>
</HTML>
========================== ========== ====
after i run the script I got an email with plain text NOT html.
Any idea?
Thanks
NMSMTP1.Connect;
NMSMTP1.FinalHeader.Add('C
NMSMTP1.EncodeType := uuMime;
NMSMTP1.PostMessage.FromAd
NMSMTP1.PostMessage.FromNa
NMSMTP1.PostMessage.ToAddr
NMSMTP1.PostMessage.ToAddr
NMSMTP1.PostMessage.Body.L
NMSMTP1.PostMessage.Subjec
If NMSMTP1.Connected then
NMSMTP1.SendMail;
==========================
test2.html file is what you posted:
<HTML>
<BODY>
<P>
Hi, <u>this</u> is an <b>HTML<b> <i>message<i>.
<hr>
<P align="center">
<font color="silver">End of Message</font>
</BODY>
</HTML>
==========================
after i run the script I got an email with plain text NOT html.
Any idea?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
With this line:
NMSMTP1.SubType := mtHTML;
These are not needed:
NMSMTP1.FinalHeader.Add('C ontent-Typ e:text/htm l');
NMSMTP1.EncodeType := uuMime;
NMSMTP1.SubType := mtHTML;
These are not needed:
NMSMTP1.FinalHeader.Add('C
NMSMTP1.EncodeType := uuMime;
Zuhair:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
split points between Cesario and EddieShipman
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thanks,
geobul
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
split points between Cesario and EddieShipman
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thanks,
geobul
EE Cleanup Volunteer
Content-type: text/html
The body of the message would contain HTML code.
The one thing you will have problems with, is including
images in the message. If you take a close look at the source of MS Outlook Express HTML messages, you'll notice that the images UUencoded and included in the message - the links to the images look like: mk:image1.gif
or something.