J
jnw
Guest
I have just changed to a new server and the asp on the site works fine but the mail part won't run(worked fine on the old server). I have spoken to Fasthosts and they tell me they support jmail, cdonts and cdo. I guess it's the mail sender that is not supported? The code I have is as follows. I am hopeing that it would be easier to adapt the code rather than write a new script which would be a problem for me, given my abilities with asp.
<%
dim firstname, email, can_we_help, Tmonth, Tday, Tyear, transfers
dim adults, children, accomodation, nights, referred_by, ref_other, Mailer
firstname = request.form("firstname")
email = request.form("email")
can_we_help = request.form("can_we_help")
Tmonth = request.form("Tmonth")
Tday = request.form("Tday")
Tyear = request.form("Tyear")
transfers = request.form("transfers")
adults = request.form("adults")
children = request.form("children")
accomodation = request.form("accomodation")
nights = request.form("nights")
referred_by = request.form("referred_by")
ref_other = request.form("ref_other")
' Creating the mail component's Instance.
Set Mailer = Server.CreateObject("Persits.MailSender")
'Saving sender's information in mail object properties to send it to Server.
Mailer.FromName = firstname ' Mail sent from name.
Mailer.From = email
Mailer.Host = "localhost" ' Mail server Address.
Mailer.AddAddress "enquiries@mydomain.co.uk"
'Mailer.AddBCC "test@test.co.uk"
Mailer.Subject = "Property Enquiry"
' Formating the information got from above declared variables in order to send it to specific address.
Mailer.Body = "mycompany" & vbcrlf & vbcrlf+_
"==================================================" & vbcrlf & vbcrlf+_
"DETAILS" & vbcrlf & vbcrlf+_
" Name: " & firstname & vbcrlf+_
" How can we help? " & can_we_help & vbcrlf+_
" Visiting Dates: " & Tmonth & "' " & Tday & ", " & Tyear & vbcrlf
if transfers = "yes" then
Mailer.Body = Mailer.Body & " Airport Transfer requires: " & transfers & "for " & adults & " & " & children & " children" & vbcrlf
else
Mailer.Body = Mailer.Body & " Airport Transfer requires: " & transfers & vbcrlf
end if
if transfers = "yes" then
Mailer.Body = Mailer.Body & " Accomodation requires: " & accomodation & " for " & nights & " nights" & vbcrlf
else
Mailer.Body = Mailer.Body & " Accomodation requires: " & accomodation & vbcrlf
end if
Mailer.Body = Mailer.Body & " Referred By: " & referred_by & vbcrlf
Mailer.Body = Mailer.Body & " Other Referal: " & ref_other & vbcrlf
' Send the mail in the above given format
On Error Resume Next ' If in case any error occurs then don't show the error and contiinue displaying page.
Mailer.Send ' Mail sent command.
If Err <> 0 Then
error_message1= "An error occurred: " & Err.Description
End If
Mailer.ResetAll
Mailer.FromName = "My Company" ' Mail sent from name.
Mailer.From = "enquiries@mycompany.co.uk"
Mailer.Host = "mail.mycompany.co.uk" ' Mail server Address.
Mailer.AddAddress email
Mailer.Subject = "my company Enquiry Confirmation"
Mailer.Body = "Thank you for your enquiry, we will contact you soon."
' Send the mail in the above given format
On Error Resume Next ' If in case any error occurs then don't show the error and contiinue displaying page.
Mailer.Send ' Mail sent command.
If Err <> 0 Then
error_message2 = "An error occurred: " & Err.Description
End If
set Mailer = nothing
%>
Thanks
<%
dim firstname, email, can_we_help, Tmonth, Tday, Tyear, transfers
dim adults, children, accomodation, nights, referred_by, ref_other, Mailer
firstname = request.form("firstname")
email = request.form("email")
can_we_help = request.form("can_we_help")
Tmonth = request.form("Tmonth")
Tday = request.form("Tday")
Tyear = request.form("Tyear")
transfers = request.form("transfers")
adults = request.form("adults")
children = request.form("children")
accomodation = request.form("accomodation")
nights = request.form("nights")
referred_by = request.form("referred_by")
ref_other = request.form("ref_other")
' Creating the mail component's Instance.
Set Mailer = Server.CreateObject("Persits.MailSender")
'Saving sender's information in mail object properties to send it to Server.
Mailer.FromName = firstname ' Mail sent from name.
Mailer.From = email
Mailer.Host = "localhost" ' Mail server Address.
Mailer.AddAddress "enquiries@mydomain.co.uk"
'Mailer.AddBCC "test@test.co.uk"
Mailer.Subject = "Property Enquiry"
' Formating the information got from above declared variables in order to send it to specific address.
Mailer.Body = "mycompany" & vbcrlf & vbcrlf+_
"==================================================" & vbcrlf & vbcrlf+_
"DETAILS" & vbcrlf & vbcrlf+_
" Name: " & firstname & vbcrlf+_
" How can we help? " & can_we_help & vbcrlf+_
" Visiting Dates: " & Tmonth & "' " & Tday & ", " & Tyear & vbcrlf
if transfers = "yes" then
Mailer.Body = Mailer.Body & " Airport Transfer requires: " & transfers & "for " & adults & " & " & children & " children" & vbcrlf
else
Mailer.Body = Mailer.Body & " Airport Transfer requires: " & transfers & vbcrlf
end if
if transfers = "yes" then
Mailer.Body = Mailer.Body & " Accomodation requires: " & accomodation & " for " & nights & " nights" & vbcrlf
else
Mailer.Body = Mailer.Body & " Accomodation requires: " & accomodation & vbcrlf
end if
Mailer.Body = Mailer.Body & " Referred By: " & referred_by & vbcrlf
Mailer.Body = Mailer.Body & " Other Referal: " & ref_other & vbcrlf
' Send the mail in the above given format
On Error Resume Next ' If in case any error occurs then don't show the error and contiinue displaying page.
Mailer.Send ' Mail sent command.
If Err <> 0 Then
error_message1= "An error occurred: " & Err.Description
End If
Mailer.ResetAll
Mailer.FromName = "My Company" ' Mail sent from name.
Mailer.From = "enquiries@mycompany.co.uk"
Mailer.Host = "mail.mycompany.co.uk" ' Mail server Address.
Mailer.AddAddress email
Mailer.Subject = "my company Enquiry Confirmation"
Mailer.Body = "Thank you for your enquiry, we will contact you soon."
' Send the mail in the above given format
On Error Resume Next ' If in case any error occurs then don't show the error and contiinue displaying page.
Mailer.Send ' Mail sent command.
If Err <> 0 Then
error_message2 = "An error occurred: " & Err.Description
End If
set Mailer = nothing
%>
Thanks