Solved

Sending html in email !

Posted on 2001-08-17
26
278 Views
Last Modified: 2008-02-26
Hi !

I want my page to send email, now, that I can manage
with text. But can someone give me an example how to send a html page as email.
I've only used JMAIL, so please give a easy example !!
0
Comment
Question by:MRSONNY
  • 9
  • 9
  • 6
  • +1
26 Comments
 
LVL 20

Expert Comment

by:jitganguly
Comment Utility
Here is the example from MSDN with CDONTS

myMail.BodyFormat = 0  is HTML

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
 
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
HTML = HTML & "<title>Sample NewMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body>"
HTML = HTML & "This is a sample message being sent using HTML. <BR></body>"
HTML = HTML & "</html>"
 
myMail.From = "Example@microsoft.com"
myMail.To = "Someone@microsoft.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing
 
0
 

Author Comment

by:MRSONNY
Comment Utility
jitganguly :

I'll get premission denied !!
0
 
LVL 20

Expert Comment

by:jitganguly
Comment Utility
Do it like
Set myMail = Server.CreateObject("CDONTS.NewMail")

BTW - Do you have SMTP services running on your web server ?

0
 

Author Comment

by:MRSONNY
Comment Utility
I'll also get expected end here

               |
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
0
 

Author Comment

by:MRSONNY
Comment Utility
---------------|
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
0
 
LVL 20

Expert Comment

by:jitganguly
Comment Utility
You must be missing some double quotes. The previosu line has 3 double quotes
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""

The full code is, just cut and paste and try

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
 
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
HTML = HTML & "<title>Sample NewMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body>"
HTML = HTML & "This is a sample message being sent using HTML. <BR></body>"
HTML = HTML & "</html>"
 
myMail.From = "Example@microsoft.com"
myMail.To = "Someone@microsoft.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing
 
0
 
LVL 7

Expert Comment

by:John844
Comment Utility
try changing
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
to
HTML = HTML & """content=""text/html; charset=iso-8859-1"">"

0
 
LVL 7

Expert Comment

by:John844
Comment Utility
I have not used jmail, but I found this on the web if you need it

It looks like you just set this property
JMail.ContentType = "text/html"
and then add your html to the body.

0
 

Author Comment

by:MRSONNY
Comment Utility
I've sloved the qoute problem :-).
I'm working on the 'premission denied'


BTW : Can't Jmail send HTML ?
0
 
LVL 7

Expert Comment

by:John844
Comment Utility
yes jmail can, see above post.
John
0
 
LVL 20

Expert Comment

by:jitganguly
Comment Utility
have you used server.createobject ?
Permission denied ? Do you have smtp installed ? IUSR_{servername} has proper permissions ?
0
 
LVL 7

Expert Comment

by:John844
Comment Utility
here is a simple example using jmail off of their site.

<%@LANGUAGE="VBSCRIPT" %>
<HTML>
<BODY>
<%
Set jmail = Server.CreateObject("JMail.Message")

jmail.AddRecipient "myRecipient@hisdomain.com", "Mr.Example"
jmail.From = "me@mydomain.com"

jmail.Subject = "Here's some graphics!"
jmail.Body = "A nice picture if you can read HTML-mail."

' The return value of AddAttachment is used as a
' reference to the image in the HTMLBody.
contentId = jmail.AddAttachment("c:\myCoolPicture.gif")

' As only HTML formatted emails can contain inline images
' we use HTMLBody and appendHTML
jmail.HTMLBody = "<html><body><font color=""red"">Hi, here is a nice picture:</font><br>"
jmail.appendHTML "<img src=""cid:" & contentId & """>"
jmail.appendHTML "<br><br>good one huh?</body></html>"

' But as not all mailreaders are capable of showing HTML emails
' we will also add a standard text body
jmail.Body = "Too bad you can't read HTML-mail."
jmail.appendText " There would have been a nice picture for you"

jmail.Send( "mailserver.mydomain.com" )
%>
Email sent! </BODY>
</HTML>
0
 
LVL 7

Expert Comment

by:John844
Comment Utility
wish you the best.  Here is a link to the site as I am leaving for the weekend.
http://www.dimac.net/
John
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:MRSONNY
Comment Utility
Hi !

It's midnight here in norway, I'll cache U up to morrow, OK.

I liked both of the answer i got, so pleas tell me how I'll
give you both 50 points !!
0
 
LVL 20

Expert Comment

by:jitganguly
Comment Utility
Accept ones here and put anotehr Q for other. Like accept my comment as answer for thsi Q and put a Q for John and you can accept his answer
0
 
LVL 20

Expert Comment

by:jitganguly
Comment Utility
O sorry 50 each for both of us ? Then ask a zero point Q in CS and ask them to split it between me and John. They will do teh rest
0
 

Author Comment

by:MRSONNY
Comment Utility
Oh, well

I'll do that :-)


0
 
LVL 7

Expert Comment

by:John844
Comment Utility
I did not see a question in CS to split the points yet.  Do you want one of us to handle splitting the points for you?
John
0
 

Author Comment

by:MRSONNY
Comment Utility
Yes pleaze, that would be very kind og you !!
0
 

Author Comment

by:MRSONNY
Comment Utility
Yes pleaze, that would be very kind of you !!
0
 
LVL 7

Expert Comment

by:John844
Comment Utility
I posted the Message CS, we should see this handled soon.
John
0
 
LVL 3

Expert Comment

by:modder
Comment Utility
MRSONNY,

OK. I've reduced the points on this question to 50

You can now award the question to one of the experts that you want to give points.

The points I refunded to you you can use to post dummy questions. Just title them
"Points for <expert ID>".

In the question body, just state:
"For your help with
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20170322 "

Once you've created the dummy question, you should find out what it's URL is. To do that, click on the "Other Questions" link at the top of this page, which brings you to the main page for this topic area. Your new dummy question will be listed at the top. Then, click on the dummy question to find out its URL, which will look a bit like this:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=NAME_OF_TOPIC_AREA_HERE&qid=XXXXXXXXXXX (a number)

Finally, come back to this question and post a comment saying "Posted dummy question for <Expert ID>", you can find it here: <url of dummy question>

Thanks for your cooperation, and if you are having any difficulties with these instructions, don't hesitate to ask for assistance.

modder
Community Support
0
 
LVL 7

Accepted Solution

by:
John844 earned 50 total points
Comment Utility
MRSONNY,  the ball is back in your court.  
step 1:  accept one our comments as the answer.
step 2:  post a new question
    step 2a:  title question "points for jitganguly"
    step 2b:  question body "for help on question http://www.experts-exchange.com/jsp/qShow.jsp?qid=20170322 "

step 3:  when jitganguly answers that question accept it.

That is all that is needed from you to finish this.
John
0
 
LVL 3

Expert Comment

by:modder
Comment Utility
step 4: post a comment here and mention the URL of the new question posted in step 2, so that jitganguly gets a notification, and I know that you've followed my instructions.

John844 - let me know if nothing happens after this.
0
 
LVL 7

Expert Comment

by:John844
Comment Utility
modder, will do.  Thanks, did not think about the notifications.
John
0
 

Author Comment

by:MRSONNY
Comment Utility
So sorry about the delay !!

... :-|
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now