Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JMail and sending to multiple address

Status
Not open for further replies.

MarcusStringer

IS-IT--Management
Sep 11, 2003
1,407
AU
Hi Guys and Girls.

I have a form which the client fills out and when they hit Submit it sends and email (HTML versionof the form) to me...This has been working great for years...

Now they want me to add their address as well so it sends to not only me but also to them.

I've added a email section into both the ASP form and HTML form and it works great, only problem is I can't get Jmail to take the value from the client email address...(if that makes sense)

Here's my code with the JMail at the bottom

Code:
<%
Function getCheckVal(inVal)
	if request.form(inVal)<>"" then
		getCheckVal="[X] "
	else
		getCheckVal="[&nbsp;&nbsp;&nbsp;] "
	end if
End Function

Function getRadioVal(inVal,compVal)
	if LCase(request.form(inVal))=LCase(compVal) then
		getRadioVal="[X] "
	else
		getRadioVal="[&nbsp;&nbsp;&nbsp;] "
	end if
End Function


[b]

bodyText=bodyText&"      <td colspan=""2"">Email:"
bodyText=bodyText&"       "
bodyText=bodyText&"       "&request.form("email")&"</td>"

[/b]

DIM strEmail
strEmail = request.form("email")


Set JMail = Server.CreateObject ("JMail.SMTPMail")

JMail.ServerAddress = "localhost"
JMail.Sender = "admin@someemail.com.au"
JMail.Subject = "Online request for information"
JMail.AddRecipient "me@someemail.com.au"
JMail.AddRecipient = strEmail
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.ContentType = "text/html"
JMail.Priority = 1

JMail.AppendText("<html>")
JMail.AppendText(bodyText)
JMail.AppendText("</html>")

On Error Resume Next
JMail.execute

if err then response.redirect("emailFailed.asp") else response.redirect("emailSucceeded.asp")
%>

Marcus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top