我不能用PHP发送电子邮件

时间:2017-04-23 23:50:34

标签: php email smtp mail-server

  

警告:mail():无法连接到“localhost”端口25的邮件服务器,验证php.ini中的“SMTP”和“smtp_port”设置或使用C:\ Users中的ini_set()...

$from = 'myemail@gmail.com';
$to = 'clientemail@gmail.com';
$subject = "welcome";
$headers = 'From: '.$from;
$message = 'Hello!';

        // Sending email
        if(mail($to, $subject, $message, $headers))
        {
            echo 'Your mail has been sent successfully.';
        } else
        {
            echo 'Unable to send email. Please try again.';
        }

0 个答案:

没有答案