[thelist] Form Submission and "From:" with ASP file

Jono ox4dboy at comcast.net
Fri Dec 3 10:43:09 CST 2004


Quick (I hope) question:

I have a form on a site, that when submitted calls a .asp file, and 
that asp file then relays the info to the correct recepient through 
email.

What I want to do is, on the Mailer.FromAddress= "..." line below, have 
the sender's email address show up in the from area.  So, the 
Mailer.FromAddress= "..." needs to get the info from the "Email" field 
of the form and display that person's email address in the "From:" area 
of the email when the recieient gets the email.


The ASP file:

  <%
  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  Mailer.FromName = "From the Name of Web site"
  Mailer.FromAddress= "I want this to be the sender"
  Mailer.RemoteHost = "mail.company.com"
  Mailer.AddRecipient "name of Recipient", "recipient at company.com"
  Mailer.Subject = "Resumé Submission"
  strMsgHeader = "Resumé information follows" & vbCrLf & vbCrLf
  for i = 1 to Request.Form.Count
  strMsgInfo = strMsgInfo & Request.Form.Key(i) & ": " & 
Request.Form.Item(i) & vbCrLf
  next
  strMsgFooter = vbCrLf & "End of resumé information"
  strMsgTime = vbCrLf & "Resumé submission time:" & now()
  Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter & strMsgTime
  if Mailer.SendMail then
  Response.Redirect "../thank-you.html"
  else
  Response.Write "Mail send failure. Error was " & Mailer.Response
  end if
  %>

Currently, when the form is submitted, the email that appears in the 
recipietn's inbox looks like this:

From: From the Name of Web site <I want this to be the sender>

"From the Name of Web site" is generated by the line, Mailer.FromName = 
"..." and "<I want this to be the sender>" is generated by the line 
"Mailer.FromAddress= "..."

I can (i think) make the Mailer.FromAddress= "I want this to be the 
sender" be Mailer.FromAddress= "" and just have the email display 
"From: From the Name of Web site" and call it a day, but I would really 
like the form submitter's name to appear after "From: " in the actual 
email that the recipient of the form gets.


Anyone have a suggestion?  I am very new to asp and form scripting.

Thanks,
Jono


More information about the thelist mailing list