如何配置php.ini以便使用mail()函数


How do I configure php.ini so I can use mail() function

所以我可以尝试通过自动系统发送电子邮件,但我需要设置我的php.ini文件。我真的不知道怎么做,所以如果你能帮忙,那就太棒了!我必须创建一个新的php.ini文件,因为我是从winhost租用的。如果你需要什么,请告诉我,非常感谢!

更新--------

我已经安装了SMTP。

嘿,我想好了,所以对于任何使用WinHost有同样问题的人来说,只需使用以下代码

$from = "Sender <postmaster@HostingAccountDomain.com>"; 
$to = "Recipient <user@HostingAccountDomain.com>"; 
$subject = "This is a test email sent via php"; 
$body = "This is a test email"; 
$host = "mail.HostingAccountDomain.com"; 
$username = "postmaster@HostingAccountDomain.com"; 
$password = "email_password"; 
$headers = array ('From' => $from, 
  'To' => $to, 
  'Subject' => $subject); 
$smtp = Mail::factory('smtp', 
  array ('host' => $host, 
  'auth' => true, 
  'username' => $username, 
  'password' => $password)); 
$mail = $smtp->send($to, $headers, $body); 

例如,我从中获取web托管服务的服务器(即MediaTemple)需要将sendmail_from设置为该域的现有电子邮件地址。因此,我在脚本中使用了以下带有我的地址的代码。

ini_set('sendmail_from', 'mail@yourdomain.com');

无论如何,如果没有这个,它就不会发送任何电子邮件。检查您的问题是否与此有关。