RSS Forums RSS

Problems sending HTML email via vbscript

Reply
Posts: 5
Reputation: closetosane is an unknown quantity at this point 
Solved Threads: 0
closetosane closetosane is offline Offline
Newbie Poster

Problems sending HTML email via vbscript

  #1  
Jan 3rd, 2009
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.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 7
Reputation: nrvinayak is an unknown quantity at this point 
Solved Threads: 0
nrvinayak nrvinayak is offline Offline
Newbie Poster

Re: Problems sending HTML email via vbscript

  #2  
Jan 12th, 2009
Please post the code. Then only it will be easier to debug and advise you.
Reply With Quote  
Posts: 5
Reputation: closetosane is an unknown quantity at this point 
Solved Threads: 0
closetosane closetosane is offline Offline
Newbie Poster

Re: Problems sending HTML email via vbscript

  #3  
Jan 18th, 2009
Originally Posted by nrvinayak View Post
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:

strReport = strReport & "<body>"
strReport = strReport & "<div align='center'>"
strReport = strReport &  "<br>"
strReport = strReport & "<table border='1' style='border-collapse: collapse'>"
   strReport = strReport & "<tr bgcolor='#DDDDDD' bordercolor='#DDDDDD'>" 
      strReport = strReport & "<td width='408' colspan='3' ><H3>" & Employer_Name & " Requested Dispatch<H3></td>" 
      strReport = strReport & "<td width='200' align= 'right'>" & FormatDateTime(Date(),1) & "</td>"
   strReport = strReport & "</tr>"
strReport = strReport & "</table>"
strReport = strReport & "<table border='1' style='border-collapse: collapse'>" 
   strReport = strReport & "<tr bordercolor='#FFFFFF'>"     
      strReport = strReport & "<td width='150'>Job Location :</td>"
      strReport = strReport & "<td width='150'>" & txtJobLocation &"</td>"
      strReport = strReport & "<td width='150'>Start Date :</td>"
      strReport = strReport & "<td width='150'>" & txtBegDate & "</td>"    
   strReport = strReport & "</tr>"
   strReport = strReport & "<tr bordercolor='#FFFFFF'>"     
      strReport = strReport & "<td width='150'>Report To :</td>"
      strReport = strReport & "<td width='150'>" & txtReport & "</td>"
      strReport = strReport & "<td width='150'>Start Time :</td>"
      strReport = strReport & "<td width='150'>" & txtTime & "</td>"
   strReport = strReport & "</tr>"
   strReport = strReport & "<tr bordercolor='#FFFFFF'>" 
      strReport = strReport & "<td width='150'>Job Type :</td>"    
      strReport = strReport & "<td width='150'>" & txtJob_Desc & "</td>"
      strReport = strReport & "<td width='150'>Living out :</td>"
      strReport = strReport & "<td width='150'>" & txtJobRegion & "</td>" 
   strReport = strReport & "</tr>"
   strReport = strReport & "<tr bordercolor='#FFFFFF'>"   
      strReport = strReport & "<td width='150'># of Members :</td>"
      strReport = strReport & "<td width='150'>" & intMembers & "</td>"  
      strReport = strReport & "<td width='150'>Journey Persons :</td>"
      strReport = strReport & "<td width='150'>" & intJourneyPerson & "</td>"   
   strReport = strReport & "</tr>" 

The code is then placed as a string into the email

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Admin@canadian.ca"
objEmail.To = "*****@shaw.ca"
objEmail.Subject = "Requested Dispatch" 
objEmail.HTMLBody = strReport
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="localhost" 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
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.
Reply With Quote  
Posts: 5
Reputation: closetosane is an unknown quantity at this point 
Solved Threads: 0
closetosane closetosane is offline Offline
Newbie Poster

Re: Problems sending HTML email via vbscript

  #4  
Jan 22nd, 2009
Problem solved
Reply With Quote  
Posts: 7
Reputation: nrvinayak is an unknown quantity at this point 
Solved Threads: 0
nrvinayak nrvinayak is offline Offline
Newbie Poster

Re: Problems sending HTML email via vbscript

  #5  
Jan 23rd, 2009
Originally Posted by closetosane View Post
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
Reply With Quote  
Posts: 5
Reputation: closetosane is an unknown quantity at this point 
Solved Threads: 0
closetosane closetosane is offline Offline
Newbie Poster

Re: Problems sending HTML email via vbscript

  #6  
Jan 24th, 2009
Originally Posted by nrvinayak View Post
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the ASP Forum
Views: 1732 | Replies: 5 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:20 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC