943,806 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 4349
  • ASP RSS
Jan 3rd, 2009
0

Problems sending HTML email via vbscript

Expand Post »
Hello,

I am sending a string created in vbScript via CDO. My scripting is working but the whole string is not showing up in the receiving email.

My code was on the bulky side with bordercolor and bgcolor in the tables cells, removing what was not needed for html in the cell code allows for more of the string to be shown via email which makes me believe that somewhere something is restricting the size the string can be.

The script is on a windows 2003 server with Plesk installed for administration. I looked in the settings for email in plesk but did not find anything that may cause this issue.

I am sure this is childsplay for some but it is really starting to get under my skin.

Thanks in advance to all/any that can help, and sorry if I posted in the wrong area/or twice -- first time I tried I received a blank page.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
closetosane is offline Offline
12 posts
since Jan 2009
Jan 12th, 2009
0

Re: Problems sending HTML email via vbscript

Please post the code. Then only it will be easier to debug and advise you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nrvinayak is offline Offline
7 posts
since Jul 2008
Jan 18th, 2009
0

Re: Problems sending HTML email via vbscript

Click to Expand / Collapse  Quote originally posted by nrvinayak ...
Please post the code. Then only it will be easier to debug and advise you.
Hello nrvinayak,

Thanks for the reply here is a snippit of the code:

ASP Syntax (Toggle Plain Text)
  1. strReport = strReport & "<body>"
  2. strReport = strReport & "<div align='center'>"
  3. strReport = strReport & "<br>"
  4. strReport = strReport & "<table border='1' style='border-collapse: collapse'>"
  5. strReport = strReport & "<tr bgcolor='#DDDDDD' bordercolor='#DDDDDD'>"
  6. strReport = strReport & "<td width='408' colspan='3' ><H3>" & Employer_Name & " Requested Dispatch<H3></td>"
  7. strReport = strReport & "<td width='200' align= 'right'>" & FormatDateTime(Date(),1) & "</td>"
  8. strReport = strReport & "</tr>"
  9. strReport = strReport & "</table>"
  10. strReport = strReport & "<table border='1' style='border-collapse: collapse'>"
  11. strReport = strReport & "<tr bordercolor='#FFFFFF'>"
  12. strReport = strReport & "<td width='150'>Job Location :</td>"
  13. strReport = strReport & "<td width='150'>" & txtJobLocation &"</td>"
  14. strReport = strReport & "<td width='150'>Start Date :</td>"
  15. strReport = strReport & "<td width='150'>" & txtBegDate & "</td>"
  16. strReport = strReport & "</tr>"
  17. strReport = strReport & "<tr bordercolor='#FFFFFF'>"
  18. strReport = strReport & "<td width='150'>Report To :</td>"
  19. strReport = strReport & "<td width='150'>" & txtReport & "</td>"
  20. strReport = strReport & "<td width='150'>Start Time :</td>"
  21. strReport = strReport & "<td width='150'>" & txtTime & "</td>"
  22. strReport = strReport & "</tr>"
  23. strReport = strReport & "<tr bordercolor='#FFFFFF'>"
  24. strReport = strReport & "<td width='150'>Job Type :</td>"
  25. strReport = strReport & "<td width='150'>" & txtJob_Desc & "</td>"
  26. strReport = strReport & "<td width='150'>Living out :</td>"
  27. strReport = strReport & "<td width='150'>" & txtJobRegion & "</td>"
  28. strReport = strReport & "</tr>"
  29. strReport = strReport & "<tr bordercolor='#FFFFFF'>"
  30. strReport = strReport & "<td width='150'># of Members :</td>"
  31. strReport = strReport & "<td width='150'>" & intMembers & "</td>"
  32. strReport = strReport & "<td width='150'>Journey Persons :</td>"
  33. strReport = strReport & "<td width='150'>" & intJourneyPerson & "</td>"
  34. strReport = strReport & "</tr>"

The code is then placed as a string into the email

ASP Syntax (Toggle Plain Text)
  1. Set objEmail = CreateObject("CDO.Message")
  2. objEmail.From = "Admin@canadian.ca"
  3. objEmail.To = "*****@shaw.ca"
  4. objEmail.Subject = "Requested Dispatch"
  5. objEmail.HTMLBody = strReport
  6. objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  7. objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="localhost"
  8. objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  9. objEmail.Configuration.Fields.Update
  10. objEmail.Send

The problem is that the entire string does not appear in the email. Removing a line from the string that does show up in the email will allow for aditional information that didn't show up in the email to now showup in the email. I dont see it as a line of code that is causing the problem but more of a string size issue. however, the string should not be so limited and in fact 'strReport' is also used to display the code on a webpage and the whole string shows up there.

Thanks in advance for any help.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
closetosane is offline Offline
12 posts
since Jan 2009
Jan 22nd, 2009
0

Re: Problems sending HTML email via vbscript

Problem solved
Reputation Points: 10
Solved Threads: 1
Newbie Poster
closetosane is offline Offline
12 posts
since Jan 2009
Jan 23rd, 2009
0

Re: Problems sending HTML email via vbscript

Problem solved
I am happy to know that you have solved the problem.

I was offline for few days and missed your post.

Anyway, it will be useful to others, if you post a brief description about the solution.

Cheers

NRV
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nrvinayak is offline Offline
7 posts
since Jul 2008
Jan 24th, 2009
0

Re: Problems sending HTML email via vbscript

Click to Expand / Collapse  Quote originally posted by nrvinayak ...
I am happy to know that you have solved the problem.

I was offline for few days and missed your post.

Anyway, it will be useful to others, if you post a brief description about the solution.

Cheers

NRV
The reason for the email not completly showing up was the ISP's settings, and did not have anything to do with the code itself. The ISP reccomended carrage returns to solve the problem.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
closetosane is offline Offline
12 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Select Statement problem
Next Thread in ASP Forum Timeline: ASP Form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC