Jump to content

New To Asp Email Cdo


gregd
 Share

Recommended Posts

The current script below is working fine, but when I try to add addition text to the body, I start getting errors. I want to add a couple of record sets to the body, can anyone help me?Set myMail=CreateObject("CDO.Message")myMail.Subject="New File Uploaded to Your Account: "&NameofFilemyMail.From="upload@national-color.com"myMail.To=(rsEmployee.Fields.Item("Email").Value)myMail.HTMLBody ="<html><p>This email was generated by national-color.com</p><br><p>The following file has been uploaded: "&NameofFilemyMail.Sendset myMail=nothing%>Text I want to add(rsClient.Fields.Item("FirstName") & (rsClient.Fields.Item("LastName") uploaded a file to your accountThis file is for job: (rsClient.Fields.Item("JobName")

Link to comment
Share on other sites

You've got examples there of adding variables to your static text, what else do you need?myMail.Subject="New File Uploaded to Your Account: "&NameofFile"The following file has been uploaded: "&NameofFileYou use the & sign to join two strings together.

Link to comment
Share on other sites

Thanks for your reply. I honestly have no idea what I'm doing. I know very basic HTML. I'm try to update our companies website that someone else did, but is no longer here. Anyways, every time I add anything after the "&NameofFile I get the error "Expected end of statement"This is how I would like the email to look that gets sent outThis email was generated by national-color.comThe following file has been uploaded: "&NameofFileThe file was uploaded by: (rsClient.Fields.Item("FirstName")The file is for job: (rsClient.Fields.Item("jobName")Using the current script below, would you be willing to add the above strings into the body of the email?Set myMail=CreateObject("CDO.Message")myMail.Subject="New File Uploaded to Your Account: "&NameofFilemyMail.From="upload@national-color.com"myMail.To=(rsEmployee.Fields.Item("Email").Value)myMail.HTMLBody ="<html><p>This email was generated by national-color.com</p><br><p>The following file has been uploaded: "&NameofFilemyMail.Sendset myMail=nothing%>

Link to comment
Share on other sites

With VBscript, it's probably easiest to build the HTML text first and then assign it to HTMLBody for the email. That looks something like this:

bodytext = "<html><p>This email was generated by national-color.com</p><br><p>The following file has been uploaded: "&NameofFilebodytext = bodytext & "<br><br>The file was uploaded by: " & rsClient.Fields.Item("FirstName")bodytext = bodytext & "<br><br>The file is for job: " & rsClient.Fields.Item("jobName")Set myMail=CreateObject("CDO.Message")myMail.Subject="New File Uploaded to Your Account: "&NameofFilemyMail.From="upload@national-color.com"myMail.To=(rsEmployee.Fields.Item("Email").Value)myMail.HTMLBody = bodytextmyMail.Sendset myMail=nothing

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...