close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with "From" address in ASP version of Universal E-mail

Thread began 11/20/2020 1:40 am by Nathon Jones Web Design | Last modified 12/02/2020 5:06 pm by Ray Borduin | 577 views | 10 replies |

Nathon Jones Web Design

Help with "From" address in ASP version of Universal E-mail

Hi. We have Universal E-mail configured on an old ASP website, supporting a standard contact form.
When the e-mail arrives with the client, they can't click "Reply" in their e-mail software because we were forced, by our host, to have a recognised POP3 address from the domain listed as the From address, otherwise it wouldn't authorise and wouldn't send.

The PHP version of this script is the same, however we can set a Reply To address in the background, because we can still edit this script due to it being PHP.

We can no longer edit the script in ASP so I wanted to ask if you could help us with a manual change to the script so that when our client clicks reply, it replies to the e-mail address that's submitted by the user in the form. The e-mail address comes from a form field called... Request.Form("swpcEMAIL")

This is the ASP Universal E-mail script....

<%
function WA_Universal_Email_1_SendMail(RecipientEmail)
dim MailObject, MailAttachments, MailBCC, MailCC, MailTo, MailBodyFormat, MailBody, MailImportance, MailFrom, MailSubject
MailAttachments = ""
MailBCC = ""
MailCC = ""
MailTo = ""
MailBodyFormat = ""
MailBody = ""
MailImportance = ""
MailFrom = "form@southwestpropertycentre.co.uk"
MailSubject = "SWPC Website Enquiry"

'Global Variables
gBodyFormat = ""

set WA_MailObject = WAUE_Definition("websmtp.livemail.co.uk","","")

if (RecipientEmail <> "") then
set WA_MailObject = WAUE_AddRecipient(WA_MailObject,RecipientEmail)
else
'To Entries
end if

'Attachment Entries

'BCC Entries

'CC Entries

'Character Set

'Body Format
set WA_MailObject = WAUE_BodyFormat(WA_MailObject,0)
MailBodyFormat = gBodyFormat

'Set Importance
set WA_MailObject = WAUE_SetImportance(WA_MailObject,"3")

'Start Mail Body
MailBody = MailBody & "<html><head><style type=" & Chr(34) & "text/css" & Chr(34) & " media=" & Chr(34) & "all" & Chr(34) & ">body {font-family: Arial, Verdana, Helvetica, sans-serif;font-size: 14px;font-weight: normal;color: #000000;background-color: #FFFFFF;} .newstitle {font-size: 18px;color: #000000;line-height: 22px;font-weight: normal;font-family: Arial, sans-serif;margin: 10px 0 10px 0;}</style></head><body>" & vbCrlf & ""
MailBody = MailBody & "<p><img src=" & Chr(34) & "http://www.southwestpropertycentre.co.uk/estate-agents-scotland/logo-swpcheader.gif" & Chr(34) & " alt=" & Chr(34) & "South West Property Centre Logo" & Chr(34) & " title=" & Chr(34) & "South West Property Centre Logo" & Chr(34) & " width=" & Chr(34) & "230" & Chr(34) & " height=" & Chr(34) & "112" & Chr(34) & " style=" & Chr(34) & "margin:15px 0 5px 0;" & Chr(34) & " /></p>" & vbCrlf & ""
MailBody = MailBody & "<p>You have received the following enquiry via the contact form on the SWPC website: </p>" & vbCrlf & ""
MailBody = MailBody & "<p>Name:<br />" & vbCrlf & ""
MailBody = MailBody & " <strong>"
MailBody = MailBody & cStr(Request.Form("swpcNAME"))
MailBody = MailBody & "</strong></p>" & vbCrlf & ""
MailBody = MailBody & "<p>Telephone:<br />" & vbCrlf & ""
MailBody = MailBody & " <strong>"
MailBody = MailBody & cStr(Request.Form("swpcTEL"))
MailBody = MailBody & "</strong></p>" & vbCrlf & ""
MailBody = MailBody & "<p>E-mail:<br />" & vbCrlf & ""
MailBody = MailBody & " <a href=" & Chr(34) & "mailto:"
MailBody = MailBody & cStr(Request.Form("swpcEMAIL"))
MailBody = MailBody & "" & Chr(34) & ">"
MailBody = MailBody & cStr(Request.Form("swpcEMAIL"))
MailBody = MailBody & "</a></p>" & vbCrlf & ""
MailBody = MailBody & "<p>Property / Enquiry:<br /> " & vbCrlf & ""
MailBody = MailBody & " <strong>"
MailBody = MailBody & cStr(Request.Form("swpcPROP"))
MailBody = MailBody & "</strong></p>" & vbCrlf & ""
MailBody = MailBody & "<p>Enquiry Details:<br /> " & vbCrlf & ""
MailBody = MailBody & " <strong>"
MailBody = MailBody & cStr(Request.Form("swpcENQ"))
MailBody = MailBody & "</strong></p>" & vbCrlf & ""
MailBody = MailBody & "<p>&nbsp;</p>" & vbCrlf & ""
MailBody = MailBody & "<p><span class=" & Chr(34) & "newstitle" & Chr(34) & ">Registered Office:</span><br />" & vbCrlf & ""
MailBody = MailBody & "South West Property Centre <br />" & vbCrlf & ""
MailBody = MailBody & "Charlotte Street <br />" & vbCrlf & ""
MailBody = MailBody & "Stranraer<br />" & vbCrlf & ""
MailBody = MailBody & "Wigtownshire<br />" & vbCrlf & ""
MailBody = MailBody & "Scotland<br />" & vbCrlf & ""
MailBody = MailBody & "DG9 7ED</p>" & vbCrlf & ""
MailBody = MailBody & "<p>Telephone: 01776 706147<br />" & vbCrlf & ""
MailBody = MailBody & " Fax: 01776 706890<br />" & vbCrlf & ""
MailBody = MailBody & " E-mail: <a href=" & Chr(34) & "mailto:property@swpc.co.uk" & Chr(34) & ">mailto:property@swpc.co.uk</a></p></body></html>"
'End Mail Body

set WA_MailObject = WAUE_SendMail(WA_MailObject,MailAttachments,MailBCC,MailCC,MailTo,MailImportance,MailFrom,MailSubject,MailBody)

set WA_MailObject = nothing
end function
%>
<%
if (("" = "")) then
'WA Universal Email object="JMail"
'Send Loop Once Per Entry
WA_Universal_Email_1_SendMail("euan@southwestpropertycentre.co.uk")
WA_Universal_Email_1_SendMail("ross@southwestpropertycentre.co.uk")

'Send Mail All Entries
if (""<>"") then
Response.Redirect("")
end if
end if
%>



Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

I haven't worked in ASP in over a decade. I'd need the other include file to see what is available. Please attach a zip of the page and any included files related to email and I can see if I can figure it out.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Aye, it has been some time since I've been near it but this client's website still works well. I attach the requested zip file.

In PHP, there is the following line which allows you to set the From address as being from the domain the website is hosted on, to satisfy the host company's requirements, but to also override that when the client hits the "Reply" button in their e-mail app, so that the client can reply to the e-mail address the client has submitted.

$Email->ReplyTo = "".((isset($_POST["FORMemail"]))?$_POST["FORMemail"]:"") ."";

My thoughts were that it must be the ASP equivalent of this line, but I have no idea how to implement that in the script.
Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

I think the line would be:

WA_MailObject.ReplyTo = cStr(Request.Form("FORMemail"))

You could add it right above the line:

'Attachment Entries

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Microsoft VBScript runtime error '800a01a8'
Object required: 'Message'

Sign in to reply to this post

Ray BorduinWebAssist

Sorry should have been:

WA_MailObject.ReplyTo = cStr(Request.Form("FORMemail"))

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

No error this time, and the form arrives with the client, but clicking Reply does not reply to the Request.Form("FORMemail") value, it uses the MailFrom value.

I've tried various combinations of this, albeit I fear that the form won't send as this breaks the host's validation rules...
MailFrom = cStr(Request.Form("FORMemail"))

...but it just produces errors and the form never sends.

NJ

EDIT: Have also tried the following, to no avail....

WA_MailObject.ReplyTo = "" & cStr(cStr(Request.Form("FORMemail"))) & "" (doesn't reply to this address)

MailFrom = "" & cStr(cStr(Request.Form("FORMemail"))) & "" (doesn't arrive)

Sign in to reply to this post

Ray BorduinWebAssist

Can you attach the confirm-enquiry.asp page with the update? I'll take a look. Please also attach the page with the form for reference.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Attached. Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

There is no form element named "FORMemail" on that page... The form element appears to be: "swpcEMAIL"

That would have to be updated in the code to match the form element name.

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...