简体   繁体   中英

Sending Email to my gmail account

I am able to send emails from my Mercury mail server to my Gmail account, but when I try to it using the mail() function in PHP, it doesn't work! Why?

<?php
if(mail('XYZ@gmail.com','NICE','OK'))
{
echo "success";
}
?>

It shows "Success" in my browser but there's no mail in my mailbox.

You cannot debug issues like this without having access to the logfile of the mail server you are using to send your email.

However, if it's a machine connected via dialup (ie one that is not in a datacenter) you are very unlikely to be able to send any emails to the big email providers as they are going to block your emails - usually only spam comes from MTAs running on dialup hosts.

have you check your spam filters? or is your mail server setup on php.ini? did u setup smtp authentication? documented by this: http://us3.php.net/manual/en/mail.setup.php

I had this same problem. It turned out that my smart-relay was missing in the mail configuration.

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