• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

phpmailer. can not connect to server

Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!

Ranch Hand
Posts: 71
PHP Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic