Solved

Sending html in email !

Posted on 2001-08-17
26
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 9
  • 6
  • +1
26 Comments
 
LVL 20

Expert Comment

by:jitganguly
ID: 6398895
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
ID: 6398933
jitganguly :

I'll get premission denied !!
0
 
LVL 20

Expert Comment

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

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

0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:MRSONNY
ID: 6398942
I'll also get expected end here

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

Author Comment

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

Expert Comment

by:jitganguly
ID: 6398954
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
ID: 6398975
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
ID: 6398987
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
ID: 6398988
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
ID: 6399004
yes jmail can, see above post.
John
0
 
LVL 20

Expert Comment

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

Expert Comment

by:John844
ID: 6399020
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
ID: 6399036
wish you the best.  Here is a link to the site as I am leaving for the weekend.
http://www.dimac.net/
John
0
 

Author Comment

by:MRSONNY
ID: 6399098
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
ID: 6399104
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
ID: 6399112
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
ID: 6399124
Oh, well

I'll do that :-)


0
 
LVL 7

Expert Comment

by:John844
ID: 6410047
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
ID: 6415105
Yes pleaze, that would be very kind og you !!
0
 

Author Comment

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

Expert Comment

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

Expert Comment

by:modder
ID: 6416605
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
ID: 6422104
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
ID: 6422147
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
ID: 6422206
modder, will do.  Thanks, did not think about the notifications.
John
0
 

Author Comment

by:MRSONNY
ID: 6427923
So sorry about the delay !!

... :-|
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in query expression 3 54
rebind a grid after user clicks on node in treeview 1 48
CREATE DATABASE 3 35
Boolean 13 24
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

733 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