Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Amazon EC2实例邮件在bitnami服务器中不工作_Php_Email_Amazon Ec2 - Fatal编程技术网

Php Amazon EC2实例邮件在bitnami服务器中不工作

Php Amazon EC2实例邮件在bitnami服务器中不工作,php,email,amazon-ec2,Php,Email,Amazon Ec2,我已经安装了用php脚本发送的邮件,但没有收到任何邮件 sudo-apt-get-install-sendmail 同时重新启动并重新启动EC2服务器 这段代码在另一台服务器上工作,但在Amzon ec2上不工作它在Amazon ec2上的工作方式 <?php /* * Enable error reporting */ ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); /* * Setup email addr

我已经安装了用php脚本发送的邮件,但没有收到任何邮件

  • sudo-apt-get-install-sendmail


  • 同时重新启动并重新启动EC2服务器

这段代码在另一台服务器上工作,但在Amzon ec2上不工作它在Amazon ec2上的工作方式

<?php
/*
 * Enable error reporting
 */
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );

/*
 * Setup email addresses and change it to your own
 */
$from = "dhokaijaydeep@yahoo.com";
$to = "dhokaijaydeep@gmail.com";
$subject = "Simple test for mail function";
$message = "This is a test to check if php mail function sends out the email";
$headers = "From:" . $from;

 // $headers = 'From:'.$from.'<' . $from . '>' . "\r\n"; message: 
// $message = "This is a test to check if php mail function sends out the email. \n\r";


/*
 * Test php mail function to see if it returns "true" or "false"
 * Remember that if mail returns true does not guarantee
 * that you will also receive the email
 */
if(mail($to,$subject,$message, $headers))
{
    echo "Test email send.";
} 
else 
{
    echo "Failed to send.";
}
?>


安装sendmail后,您是否重新启动了服务器?请检查您的
php.ini
,sendmail处于启用状态或不启用状态,然后重新启动并重新启动EC2服务器。如何检查php.ini中的邮件功能启用