• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

phpmailer. can not connect to server

 
sahar eb
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have this contact.php file which processes the data coming from a form. This file tries to send the entered information to an email using PHPMailer (If they are validated). here is the code snippet:


and here is the error it throws:



I am new at this so please give me a clear answer or examples! I have searched a lot, but still couldn't solve it!
any help or suggestion would be deeply appreciated!
Thank you so much!

Sahar.
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are a couple of suggestions:

1) Are you sure you have the correct hostname? Try doing

ping mail.mysite.co

and see if you get a result. (The name lookes starnage to me, usually the last part should be .com)

2) Are you sure that port 25 is open and not blocked by a firewall? Try this to see if the port is accessible:

telnet mail.mysite.co 25

If it accessible you will get some result (gibbersh, screen refresh). If the port is not accessible, you will get a connection error.

3) Are you sure you have the correct username and password (mailer@mysite.co/mysite23) to connect to mail server? Some mail servers only want the name and not the "@hostname" portion to log in.

4) Do you own mail.mysite.co? If so, what OS is it running? If you don't own it, are you sure that you have access to it? I ask because if that site is running MS Exchange you might not have the necessary access rights (I run into that all the time at work - I cannot programmatically access the same Exchange server that Outlook has access to so we have configured a gateway system that we use when testing email code or configuring other apps to send emails).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic