Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sending E-mail With HTML body using ASP ad Jmail

Posted on 2004-11-26
17
Medium Priority
?
1,477 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:deliriumxx
  • 8
  • 3
  • 2
  • +1
14 Comments
 

Author Comment

by:deliriumxx
ID: 12684579
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
 
LVL 3

Expert Comment

by:rajuare
ID: 12684981
r u using CDO or jmail ?? let me know
0
 

Author Comment

by:deliriumxx
ID: 12687751
I can use any. I would prefere jmail but cdo is ok as well.
0
Independent Software Vendors: 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!

 

Author Comment

by:deliriumxx
ID: 12687756
I foun a way for CDO to work,,, so that part is ok,,,

is there equaly simple way to do it with Jmail?
0
 

Expert Comment

by:bhoard1
ID: 12692640
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
 

Author Comment

by:deliriumxx
ID: 12692676
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
 

Accepted Solution

by:
bhoard1 earned 100 total points
ID: 12696442
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
 

Author Comment

by:deliriumxx
ID: 12697850
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
 

Author Comment

by:deliriumxx
ID: 12697863
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
 

Expert Comment

by:bhoard1
ID: 12705960
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
 

Author Comment

by:deliriumxx
ID: 12709465
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
 
LVL 2

Assisted Solution

by:cgraving
cgraving earned 100 total points
ID: 12825709
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
 

Author Comment

by:deliriumxx
ID: 12825849
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
 
LVL 2

Expert Comment

by:cgraving
ID: 12830453
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
By following these Magento e-commerce development tips, you can increase your website's conversion and profitability. Read this post for more details.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

581 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