Sending html in email !

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 !!
MRSONNYAsked:
Who is Participating?
 
John844Commented:
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
 
jitgangulyCommented:
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
 
MRSONNYAuthor Commented:
jitganguly :

I'll get premission denied !!
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
jitgangulyCommented:
Do it like
Set myMail = Server.CreateObject("CDONTS.NewMail")

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

0
 
MRSONNYAuthor Commented:
I'll also get expected end here

               |
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
0
 
MRSONNYAuthor Commented:
---------------|
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
0
 
jitgangulyCommented:
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
 
John844Commented:
try changing
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
to
HTML = HTML & """content=""text/html; charset=iso-8859-1"">"

0
 
John844Commented:
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
 
MRSONNYAuthor Commented:
I've sloved the qoute problem :-).
I'm working on the 'premission denied'


BTW : Can't Jmail send HTML ?
0
 
John844Commented:
yes jmail can, see above post.
John
0
 
jitgangulyCommented:
have you used server.createobject ?
Permission denied ? Do you have smtp installed ? IUSR_{servername} has proper permissions ?
0
 
John844Commented:
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
 
John844Commented:
wish you the best.  Here is a link to the site as I am leaving for the weekend.
http://www.dimac.net/
John
0
 
MRSONNYAuthor Commented:
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
 
jitgangulyCommented:
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
 
jitgangulyCommented:
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
 
MRSONNYAuthor Commented:
Oh, well

I'll do that :-)


0
 
John844Commented:
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
 
MRSONNYAuthor Commented:
Yes pleaze, that would be very kind og you !!
0
 
MRSONNYAuthor Commented:
Yes pleaze, that would be very kind of you !!
0
 
John844Commented:
I posted the Message CS, we should see this handled soon.
John
0
 
modderCommented:
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
 
modderCommented:
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
 
John844Commented:
modder, will do.  Thanks, did not think about the notifications.
John
0
 
MRSONNYAuthor Commented:
So sorry about the delay !!

... :-|
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.