Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all, I've got a form which work well when an email is set from the same domain.

My problem is that I want the script to send the email to an account not from the same domain. (ie:me@mydomain.com.au works when I change the email to you@yourdomain.com it does not send the mail)

Below you will find my full code, If any one can help me, it would be appreciated:

ASP
<%
  DIM StrEmail, StrName, StrNumber, StrSubject, StrMessage, StrMsgHeader

   StrEmail = request.form("email")
   StrName = request.form("name")
   StrNumber = request.form("number")
   StrSubject = request.form("subject")
   StrMessage = request.form("message")

  Set Mail = Server.CreateObject("Persits.MailSender")
    Mail.Host = "mail.mydomain.com.au";
    Mail.From = "me@mydomain.com.au"
    Mail.AddAddress "you@yourdomain.com.au"
 


        Mail.Subject = "Enquiry Request Form"

 
     Mail.Body = strMsgHeader & "Email: " & StrEmail & vbCrLf & vbCrLf & _
     "Full Name : " & vbCrLf & StrName & vbCrLf & vbCrLf & _
     "Phone Number : "; & vbCrLf & StrNumber & vbCrLf & vbCrLf & _
     "Subject : " & vbCrLf & StrSubject & vbCrLf & vbCrLf & vbCrLf & _

     "Message: " & vbCrLf & StrMessage

   
     On Error Resume Next
     Mail.Send
     Set Mail = Nothing

    IF Err <> 0 THEN
     Response.Write "There has been an error and your message could not be sent through email." & Err.Description
    END IF

    %>
Posted
Updated 2-Jun-11 17:44pm
v2

There can be various scenarios associated with that.
1) Make sure that you are using correct domain for the email you are using to send.
2) Check what is the smtp port that domain is using (it can be other that port 25)
3) The port used for send email is not blocked by Firewall.

Hope that helps.
 
Share this answer
 
Comments
thatraja 3-Jun-11 1:39am    
Yep, possible reasons(sure). 5!
Wild-Programmer 3-Jun-11 1:44am    
Thanks Raja :)
<u></u>Thanks Amit,
The 1st 2 points are fine, domain is correct and the port is fine, what do you mean in the 3rd point regarding the firewall.

If it is an issue with the firewall how do i get around it.

Sorry I didn't respond earlier...
 
Share this answer
 
Comments
Wild-Programmer 5-Jun-11 6:12am    
You need to allow the port through the firewall. Contact the admin or the person who manages the firewall.

If you are going to do it yourself, you can try video @ http://www.youtube.com/watch?v=SJ-oDNR91Rk
You can find the steps of google as well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900