简体   繁体   English

无法使用mail()php发送邮件?

[英]Not able to send mail using mail() php?

I am Not able to send mail with This Code ? 我无法使用此代码发送邮件吗?

CODE : 代码:

<?php
// the message
$msg = "Thank You";

// send email
echo mail("*****@gmail.com","My subject",$msg);
?>

尝试wordwrap();

 $msg = wordwrap($msg,70);

It's probably because you don't have your mail server configured. 可能是因为您没有配置邮件服务器。 Try to do it in php.ini or install mail catcher. 尝试在php.ini中执行此操作或安装邮件捕手。 For example: http://mailcatcher.me/ 例如: http : //mailcatcher.me/

Also check http://php.net/manual/en/mail.configuration.php 还要检查http://php.net/manual/en/mail.configuration.php

There may be several answers for that : 可能有几个答案:

  • If you are on a local server, maybe your mail server isn't configured 如果您在本地服务器上,则可能未配置邮件服务器
  • If you are on a shared host, the function may have been deactivated. 如果您在共享主机上,则该功能可能已停用。

What's the return of the mail() function ? mail()函数的返回值是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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