Php Amazon EC2实例邮件在bitnami服务器中不工作
我已经安装了用php脚本发送的邮件,但没有收到任何邮件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
- sudo-apt-get-install-sendmail
- 同时重新启动并重新启动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中的邮件功能启用