[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] Re: Send email from web page



> Aloha,
>
> I searched the archives and could not find an answer to thise question.
>
> One of our customers would like people to fill out a form them press the
> "submit" button and have it emailed to a specific email address.  Does
> anyone have a sample web page script that will accomplish that?  I have
done
> the 'mailto:XXX', but this will send right from the page.
>
> If it matters we are using an XTR.
>


Matt,

You should have the current version of Chili!Soft on your XTR.  The format of the CDO NewMail object (in ASP/JavaScript) is below.  It assumes your button is called "Submit" and that the form field 'UsersEmail' is a legally formatted email address. You will need to tweak it to your specifications:

<% if (String(Request("Submit")) != "undefined")
{
var objCDO = Server.CreateObject("CDONTS.NewMail");
objCDO.From = Request.Form("UsersEmail")
objCDO.To = "myemail@xxxxxxxxxxxx"
objCDO.cc = ""
objCDO.BodyFormat = "0"; // Set to 0 to allow html, 1 to disallow.
objCDO.Subject = "Email from website"
objCDO.Body = "The text of the message:<br><br>"+Request.Form("MessageBody");
objCDO.Send()
objCDO = null
Response.Redirect("thankyou.htm")
}
%>

Good luck!

Jay