hi,

I creating an application whereby I am generating a password and then mailing it to the user.

I have been trying the mailto function but the mail is not sent to the recipient. Here's my code:

$to="chitra@yahoo.com";

  $subject = "New Password";
$email = $_REQUEST['mail'] ;
$message = "Your 8 character password is: $password" ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; 
}

I am not getting any error. It just says that the email was sent sent successfully, but it actually doesnot. Please help.

Hi Chitra,

This code should work fine. Try this.
Change your

$sent = mail($to, $subject, $message, $headers) ;

to

$sent = mail("$to", "$subject", "$message", "$headers") ;

Let me know if this worked or not!

-Kavitha Butchi

Hi, I did try what yiou said but it just doesnot work. I think there's a problem in my configuration in my ini.php file. I have looked for the right configuration and this is what I got


I've set the following fields in my ini.php file as follows but now it is not even connecting tomy server:


SMTP = smtp.my.isp.net
sendmail_from = me@myserver.com

This is what I am getting:

Warning: mail(): Failed to connect to mailserver at "smtp.my.isp.net" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\easyphp1-8\www\proj final\new\checkpass.php on line 71


Can anyone please tell me what is z problem. Please It is very URGENT!!!!!!!!!!!!!!1


Thank you.

Try these then,

Did you check if your AntiVirus is blocking Port 25?

Also make a check with your Firewall which might be blocking the port.
Start - Settings- Network Connections - Advanced tab - Setting - exceptions "if you SMTP is not there, click Add Port , on the name field you can write (SMTP TCP) and under port type 25, then hit ok.

Also do that again but with the same port and name with UDP.

If you are behind a router , your ISP might blocked port 25 or you might just need to forward port 25 from your router seetings "portforward dot com/"


If you want to know if your port 25 is open or see this website canyouseeme dot org and on the field type 25 that will tell you
if your port is active.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.