Sending E-mail With HTML body using ASP ad Jmail

How am I suppose to store dynamic data into a body of an e-mail and then send it in an e-mail...
I don't need all the steps, just to get

jmail.HtmlBody = ?????

Can somebody help?
Please

D
deliriumxxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

deliriumxxAuthor Commented:
I tried this:

Dim objMail2 'declare the variable

Set objMail2 = Server.CreateObject("CDO.Message") 'create your server object - CDO.Message

With objMail2 'here begins the mailing info

.To = "mailto@yourcustomer.com" 'whoever is receiving the email
.CC = "yourself@yourself.com" 'or whoever else you would like to CC
.From = "info@yourcompany.com" 'self explanatory
.Subject = "Our Newsletter" 'or whatever you would like the subject to be
.CreateMHTMLBody "my_newsletter.asp" 'this is our baby, seems so simple, doesnt it?
.Send 'send it off...

End With 'end the mailing info
Set objMail2 = Nothing 'kill the object

But I get error message saying

CDO.Message.1 (0x800C000D)
The specified protocol is unknown.

Can smeone help with this?

D
0
rajuareCommented:
r u using CDO or jmail ?? let me know
0
deliriumxxAuthor Commented:
I can use any. I would prefere jmail but cdo is ok as well.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

deliriumxxAuthor Commented:
I foun a way for CDO to work,,, so that part is ok,,,

is there equaly simple way to do it with Jmail?
0
bhoard1Commented:
I'm not sure if I understand your question exactly, but I concatentate strings to Jmail messages all the time.

JMail.Body = JMail.Body & var1 & " blah blah blah " & var2 & " something else."
Jmail.Body = JMail.Body & var3 & " That is all there is to this message."

Since you are using the HTML body, then its the same syntax, only replace the JMail.Body with the JMail.htmlBody.  

With the HTMLBody, you'll be able to use <br> for line spacing, otherwise you'll need to concatenate a chr(13) to the end of each paragraph.
0
deliriumxxAuthor Commented:
I see
All in all crappy.... I don't feel like building a whole dynamic script exclusively for jmail since I already have the whole system built as normal people do it. In an ASP page.
Jmail didn't solve a beautiful little CreateMHTMLBody "http://www.blabla.com" option

But here is the problem that I encountered with CDO, Just now

Why do I get an error messageerror '80040211'
in a line that says myMail.send when I am using myMail.Configuration.Fields.Item with CreateMHTMLBody
and If I am not using CreateMHTMLBody then all is fine???

I NEED CreateMHTMLBody and myMail.Configuration.Fields.Item to work together, grrrrr,, lol

Here is the code that generates the error:

Set myMail=CreateObject("CDO.Message")
myMail.From="me@somaddress.com"
myMail.Subject="mail subject"
myMail.To="someone@somaddress.com"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailserver
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.CreateMHTMLBody "http://www.somaddress.com

myMail.Send
0
bhoard1Commented:
JMail does provide for emailing a website within an email message -- at the time of the creation an HTML snapshot is taken of a target webpage and then the code is inserted into an email via the GetMessageBodyFromURL(bstrURL, [bstrAuth]) method (JMail v3.7).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
deliriumxxAuthor Commented:
I've tryed that,,,,

It is flod. Works but is the email is treated and classified as spam. Weird, but it is like that. When i use CDO that spam clasification doesn't happen.
No Prob,,, I solved it with CDO.

Thanks anyway.
0
deliriumxxAuthor Commented:
Set myMail=CreateObject("CDO.Message")
myMail.From="me@somaddress.com"
myMail.To="someone@somaddress.com"
myMail.Subject="mail subject"
myMail.CreateMHTMLBody "http://www.somaddress.com
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailserver
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.Send


This worked ok for me.
0
bhoard1Commented:
The spam classification could have more to do with the reverse DNS of the linked to graphics versus the DNS of the SMTP server than the content of the email itself.  Either way, there will be NO 100% SOLUTION to prevent your outbound emails from falling victim to an overzealous spam filter.
0
deliriumxxAuthor Commented:
As I said, CDO works around the problem. It actualy creates a mail body. The others don't. They do something else instead. I've been reviewing some documentation.... anyway....
thanks for trying.

D
0
cgravingCommented:
your my_newsletter.asp, does it have dynamic content that changes issue to issue in format, or just text and graphics changing?  Are you satisified with your solution?
0
deliriumxxAuthor Commented:
Mean while I had to go back to Jmail and manualy creating .HTMLBody. Page html wasn't good enough because I needed to exclude some options in mail body creation as well.

The CDO solution in general did make me feel satisfied as far as "my_newsletter.asp" was concerned, and it did have a dynamic content that changed issue to issue in format as you put it. Very little graphics though, and it was atualy a self generating purchase order, not newsletter as used in example.
I have noticed one issue though and in the long run I wouldn't recomed the solution. It actualy needs to be programmed with certan data types in certain order which is a suicide if the script is long and that puts us back to "dynamic content that changes issue to issue in format". Do not use it if all html generation derives from ASP. IT will not work. You will either be unable to send the page or if you send it it will be blank.

Need something specific on the subject or you are asking out of pure curiousity? :)
0
cgravingCommented:
Well, I had a similar situation as far as I can tell.  What I did was store the output of the email as HTML using homemade tags instead of actual asp.  In the aSP page sending the email I just used replace statements to put the text data in.  That is why I was wondering about format changes each time instead of just text or image substitution.  I used FilesystemObject to open the template html page and read out the html to string.  My html "homemade" tags were like ||MainBody||.  Then I would do something like strTemp = Replace(strTemp,"||MainBody||",datastring), then send the email with the html body being strTemp.  Probably not the cleanest solution or the fastest running, but seemed easy enough.  also worked great for just plain text emailings where names and such needed to be parsed for each recipient.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

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.