|
| |
|
|
hessfirm
Posts: 153 Joined: 9/15/2004 Status: offline
|
HTML Email with ASPQmail and DRW - 12/12/2005 12:26:30
I use ASPQmail to generate emails for site visitors. It works well. Below is script for anyone wishing to create HTML emails using ASPQmail and the DRW for database automation. (it also includes the ability to substitute text for html.) Thanks Spooky for your help. <% ' **************************************** ' * DO NOT MODIFY THE FOLLOWING VALUES * ' * ServerObjects Inc. will NOT debug * ' * multi-part message problems! * ' * DO NOT MODIFY THE FOLLOWING VALUES * ' **************************************** BOUNDARY = "----xxxxxx" TEXT_HEADER = "--" & BOUNDARY & VBCrLf & "Content-Type: text/plain;" & VBCrLf & _ "Content-Transfer-Encoding: 7bit" & VBCrLf & VBCrLf HTML_HEADER = "--" & BOUNDARY & VBCrLf & "Content-Type: text/html;" & VBCrLf & _ "Content-Transfer-Encoding: 7bit" & VBCrLf & VBCrLf MP_FOOTER = "--" & BOUNDARY & "--" & VBCrLf ' ****************************************************** ' * Set strTextBody to your message in plain text format ' ****************************************************** strTextBody = "Here's the information you requested in text format..." & VBCrLf & _ "Cordially," & VBCrLf & "The Management" ' ****************************************************** ' * Set strHTMLBody to your message in HTML format ' ****************************************************** strHTMLBody = "<html><head><title>The Information You Requested</title></head>" & _ "<body bgcolor=""Black"" text=""Yellow"" link=""#0000FF"" vlink=""#800080"">" & _ "<img src="""&FP_FieldVal(fp_rs,"flyer")&""">" & _ "</body></html>" ' **************************************** ' * alternatively, above, if you want to use an actual image instead of the DRW, it would be "<img src=""http://www.mysite.com/images/myimage.jpg"">" & _ * ' **************************************** ' **************************************** ' * DO NOT MODIFY THE FOLLOWING VALUE * ' **************************************** strBody = TEXT_HEADER & strTextBody & VBCrLf & HTML_HEADER & strHTMLBody & VBCrLf & MP_FOOTER ' **************************************** ' * Code your Mailer Object creation and ' * setup here ' **************************************** Set Mailer = Server.CreateObject ("smtpsvg.mailer") Mailer.QMessage = "true" Mailer.RemoteHost = "your mail server or smtp address goes within these quotes (for example: ns3.myhost.net)" Mailer.AddRecipient "Someone", ""&FP_FieldVal(fp_rs,"email")&"" Mailer.FromName = "Your Company Name" Mailer.FromAddress = "bob@emailaddress.com" Mailer.Subject = "MultiPart Message" ' **************************************** ' * DO NOT MODIFY THE FOLLOWING VALUES * ' **************************************** Mailer.ContentType = "multipart/alternative; boundary=""" & BOUNDARY & """" Mailer.BodyText = strBody ' **************************************** ' * Send the message ' * Code your testing for the success of ' * SendMail here ' **************************************** if Mailer.SendMail then Response.Write ("<br>Mail sent OK") else Response.Write ("<br>Mail failed. Error was " & Mailer.Response) end if Set Mailer = Nothing %>
_____________________________
Steve Hess
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|