Forums

ASP

This topic is locked

ASP Template Email.

Posted 17 Nov 2012 23:12:14
1
has voted
17 Nov 2012 23:12:14 Gareth Pointon posted:
HI,

I have recently run in to an issue on some old scrip that emails a copy of the customers order to them.

This scrip used the following code:
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP"

However reading on I see Microsoft have made changes that do not allow you to use this function on the same domain.

I have a email script that has to pass over a Order ID value to a ASP email Template.

The ASP Email Template if a copy of the order sheet the customer is presented with when completing an order.
This is a table or all the goods they have ordered with totals and so on.

I'm albe to use a as template using replace but that will not work with the amount of rows and information that would have to be replaces.

Can anyone please assist in this old script now as I know its getting less and less supported.

Any help greatly appreciated.

I'm also purchasing a years subscription to DMZ so if there is anything anyone can recommend I will be grateful.

Replies

Replied 19 Nov 2012 20:29:44
19 Nov 2012 20:29:44 Gareth Pointon replied:
Can anyone please help on this issue.

I've been on this weeks now ...

God I hate Microsoft.....
Replied 20 Nov 2012 10:31:15
20 Nov 2012 10:31:15 MX Addict replied:
I really don't understand what you want. Do you use de DMX Smartmailer extension or did you write a script by yourself.

A very good ASP website forum is:

www.aspmessageboard.com/index.php
Replied 20 Nov 2012 17:59:19
20 Nov 2012 17:59:19 Gareth Pointon replied:
Hi,

Sorry this is a script that I wrote that will take a ASP page with the customers orders details on from a Database and insert it in to a HTML email body.

This is the full script:

Function Mailbody
Datatosend = ("OrderID=" & OrderID)

Set objXML = Server.CreateObject("MSXML2.serverXMLHTTP.6.0"

objXML.open "POST", SiteRoot & "email.asp", False
objXML.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXML.send Datatosend

Mailbody = objXML.responsetext

Set objXML = Nothing
End Function

At the moment I'm not using any of the plugins from DMX as I'm not sure if any will work.

If the ASPSmartmailer will take a ASP template then great.

If not I just need to take the information from the ASP template that pulls the information from the Database.

Hope someone can help.
Replied 20 Nov 2012 18:31:40
20 Nov 2012 18:31:40 MX Addict replied:
Yes it is possible to use Smartmailer with a template.

You create a template page like temp.asp that contains a recordset. Filter a url parameter like a unique autonumber.

Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("autoID") <> "") Then 
  Recordset1__MMColParam = Request.QueryString("autoID")
End If

Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_connection_STRING
Recordset1_cmd.CommandText = "SELECT * FROM table_members WHERE autoID = ?" 
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDouble

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0




The Smartmailer contains a option to include a template.

temp.asp?autoID=##(Recordset1.Fields.Item("autoID").Value)##


So now the template is include at SmartMailer

Replied 20 Nov 2012 18:47:30
20 Nov 2012 18:47:30 MX Addict replied:
You can also create your own email page like:

Dim htmlbody
htmlbody = "<html>" & vbcrlf _
		& "<head>" & vbcrlf _
		& "<title>" & CStr(rsEmail("subject")) & "</title>" & vbcrlf _
		& "<style type=""text/css"">" & vbcrlf & "body {font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #666; background-color: #fff;}" & vbcrlf & ".top {text-align: center;}" & vbcrlf & ".bottom {font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #999; background-color: #fff;}" & vbcrlf & ".naw, a:link, a:visited {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333; text-align: center; margin-bottom:0; padding-bottom:0;}" & vbcrlf & "</style>" & vbcrlf _
		& "</head>" & vbcrlf _
		& "<body>" & vbcrlf _
		& "<div class=""top"">" & vbcrlf _
		& "<img src=""cid:company.png"">" & vbcrlf _
		& "</div>" & vbcrlf _		
		& "<p>" & CStr(rsEmail("autoID")) & "</p>" & vbcrlf _
		& "<hr>" & vbcrlf _
		& "</body>" & vbcrlf _
		& "</html>" 


sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = CreateObject("CDO.Configuration")
Set cdoMessage = Server.CreateObject("CDO.Message")
 
    With cdoConfig.Fields 
        .Item(sch & "sendusing") = 2 ' cdoSendUsingPort 
        .Item(sch & "smtpserver") =  ' cdoSmtpserver required
		.Item(sch & "smtpserverport") = 25
        .update 
    End With

	With cdoMessage
	
	Set .Configuration = cdoConfig	
        .From = ""&CStr(rsCompany("name"))&" <"&CStr(rsCompany("email"))&">"
		.To = CStr(rsEmail("email"))
        .Subject = CStr(rsEmail("subject")) 
        .HTMLBody = htmlbody
	Set objBP = cdoMessage.AddRelatedBodyPart(Server.MapPath("images/company.png"), "company.png", CdoReferenceTypeName)
        .Send
    End With

	Set cdoMessage = Nothing
	Set cdoConfig = Nothing
End If


Replied 25 Nov 2012 18:11:33
25 Nov 2012 18:11:33 Gareth Pointon replied:
Hi,

I have the ASP Smart Mailer and am trying to use a ASP template that has a database in.

I have tried with a HTML template and this works OK.

I'm getting the following error:

msxml3.dll error '80072ee2'

The operation timed out

../ScriptLibrary/incSmartMailer.asp, line 1254

Can anyone assist please.
Replied 25 Nov 2012 19:41:11
25 Nov 2012 19:41:11 Gareth Pointon replied:
I have even followed the information on this article:

www.dmxzone.com/go/12744/the-operation-timed-out-msxml3-dll-error-80072ee2/

Reply to this topic