Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

sending HTML email from another page

Posted 09 Mar 2004 11:38:14
1
has voted
09 Mar 2004 11:38:14 Peter Borcherds posted:
Hi,

I'm trying to get a page containing HTML to be sent as an email from another page - the code I am using at the moment is:

<pre id=code><font face=courier size=2 id=code>
&lt;%
Function Mailbody
on error resume next
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP"
' Call the remote machine the request
objXML.open "POST", SiteRoot & "email.asp", False
objXML.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
'objXML.send("OrderID=" & OrderID)
objXML.send("OrderID=16"
' return the response
Mailbody = objXML.responsetext
' clean up
Set objXML = Nothing
End Function
%&gt;
</font id=code></pre id=code>

However, my hosts server is bringing back the error...

<pre id=code><font face=courier size=2 id=code>
msxml3.dll error '80072efd'

A connection with the server could not be established

/Functions_email.asp, line 57
</font id=code></pre id=code>

I know how to solve that, but my hosts are not willing to make the change (ie. configure MSXML2.ServerXMLHTTP correctly)

Therefore, does anyone know of any other code I can use that will enable me to pass a variable to a page then send that page as an HTML email?

My complete code, to make more sense of this is:

<pre id=code><font face=courier size=2 id=code>
&lt;%
'Start the functions
function SendEmail
Set objMail = Server.CreateObject("CDONTS.NewMail"
objMail.From = " "
objMail.To = CustomersRS("CustomerEmail"
objMail.Subject = "Order from Products website"
objMail.Body = Mailbody
objMail.MailFormat=0
objMail.BodyFormat=0
objMail.Send
Set objMail = Nothing
end function

function SiteRoot
'This function tries to ascertain the site root. If it's wrong, enter your own manually
CurrentPage=Request.ServerVariables("SCRIPT_NAME"
SiteRoot="" & Request.ServerVariables("SERVER_NAME" & left(CurrentPage,instrrev(CurrentPage,"/")
end function

Function Mailbody
on error resume next
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP"
' Call the remote machine the request
objXML.open "POST", SiteRoot & "email.asp", False
objXML.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXML.send("OrderID=" & OrderID)
' return the response
Mailbody = objXML.responsetext
' clean up
Set objXML = Nothing
End Function
%&gt;
</font id=code></pre id=code>

Thanks,

Peter

DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / PHP / MSAccess 2000 / SQL Server 2000 / mySQL

www.palizdesign.com

Edited by - paliz on 25 Oct 2006 20:25:55

Edited by - paliz on 09 Nov 2006 02:11:17

Replies

Replied 09 Mar 2004 15:53:49
09 Mar 2004 15:53:49 sander kerstens replied:
hi Paliz,

i make sure that my system has jmail which is easier to use and more advanced...

with jmail you can attach an asp or html page with easy and if asp then
you can parse url parameters to search
the database for the results you whish
to mail....

so perharps looking for another hosting my solve you're issue..

good luck..

greetz Sander
Replied 09 Mar 2004 16:26:49
09 Mar 2004 16:26:49 Peter Borcherds replied:
Hi Sander,

I'll look into that...the thing is the code I have makes it really simple, that is if the object is correctly setup on the server, which in this case is not. Unfortunately I can't change hosts as this is for a client who hosts their own servers - their server guys are being really sticky about changing configurations on the servers...even though it is only one command they have to enter in the command line...!

I just thought I could easily get around it. Also, the code I have put below at the beginning of my post is used by jmail and ASPEmail as well...all it does is set the variables for 'Mailbody' - so, even if I use jmail it will not solve the problem, unless I use one of jmail's other functions, which I will look into now.

Thanks &lt;img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle&gt;

Peter

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hi Paliz,

i make sure that my system has jmail which is easier to use and more advanced...

with jmail you can attach an asp or html page with easy and if asp then
you can parse url parameters to search
the database for the results you whish
to mail....

so perharps looking for another hosting my solve you're issue..

good luck..

greetz Sander
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / PHP / MSAccess 2000 / SQL Server 2000 / mySQL

www.palizdesign.com

Edited by - paliz on 25 Oct 2006 20:26:16

Reply to this topic