tags:

views:

346

answers:

4

hello,

I have written a basic script for the mail functionality. I am trying to run this script through WAMP server.

<?php
phpinfo();

$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From: $from";
$res= mail($to,$subject,$message,$headers);
echo " $res Mail Sent.";
?>

I have set the SMTP, sendmail_from in the php.ini file . It gives me the following error

Warning: mail() [function.mail]: Failed to connect to mailserver at "mucse409.eu.xyz.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\email.php on line 9 Mail Sent.

I am able to ping the SMTP address from my machine. Please guide me.

A: 

Can you also send mail from this machine to this smtp server using some mail client like ms outlook or mozilla thunderbird?

I had a problem once that my provider block traffic directed at smtp ports outside due to virus infection, and I couldn't send mail because of this, but I could ping server and port.

Kamil Szot
I can send through MS outlook from the same SMTP server.
mithunmo
A: 

Could be blocked by a firewall or some such.

See if you can open port 25 with telnet (If you don't have software for this, you can download putty)

JasonWoof
I am not able to open my SMTP server address nor smtp.gmail.com( port 465/587 ) .Does this mean firewall is blocking ?
mithunmo
Yeah, the simple way to test if it's your local firewall, is to try that port on other systems, where you know it's open.Most likely a firewall of some kind. Look at any firewall or antivirus type programs on your computer, and on your router if you're behind one.
JasonWoof
A: 

Your username and password not matched with the mailserver. Please check it.

Tareq
I am not sending any username and password .
mithunmo
A: 

Following this tutorial I was able to send mail .

link text

mithunmo