简体   繁体   中英

trouble in php mail function

My php.ini looks like this :

    ; For Win32 only.
    ; http://php.net/smtp
    SMTP = localhost
    ; http://php.net/smtp-port
    smtp_port = 25

    ; For Win32 only.
    ; http://php.net/sendmail-from
    sendmail_from = you@yourdomain

    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    ; http://php.net/sendmail-path
    sendmail_path = "/usr/sbin/sendmail -t -i -f akeel_mn@yahoo.com"

and my php code looks like this :

    <?php
    if(isset($_REQUEST['mail']))
    {
$success = mail("akeel26@gmail.com","hello","Welcome to our site!");
if($success)
{
    echo 'mail send';
}
else
{
    echo 'error';
}
    }
    ?>

when I run the prog it displays as mail send but the mail doesn't get delivered to the intended recipient.. does anybody know what's wrong? is there any more configuration to be made other than in the php.ini?

Are you hosted on a site that supports email or hosting from home? A lot of times home ISP providers will block all outgoing port 25 traffic. so it will sit in the queue and show as timed out.

i also notice your missing headers. dont know if that makes a difference.

$to = "whoever@wherever.com;
$subject = "About mail";
$message = "something to say"
$headers = "From: noreply@wherever.com";
mail($to,$subject,$message,$headers);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM