可以在没有 gmail 的情况下从本地主机发送邮件吗?
sending mail from localhost without gmail is it possible?
我想在 ubuntu 上使用 xampp 使用 php mail() 函数发送电子邮件。但是它没有发送。请检查我的代码。我是否需要为其设置任何电子邮件服务器(如 gmail),或者我可以在没有 gmail 的情况下设置?
<?php
$address = "kthakkar@argusoft.com";
$subject = 'Test email';
$body = 'If you can read this, your email is working.';
echo "Attempting to email $address...<br />";
if (mail($address, $subject, $body)) {
echo 'SUCCESS! PHP successfully delivered email to your MTA. If you don\'t see the email in your inbox in a few minutes, there is a problem with your MTA.';
} else {
echo 'ERROR! PHP could not deliver email to your MTA. Check that your PHP settings are correct for your MTA and your MTA will deliver email.';
}
?>
如果我使用 smtp gmail 帐户,它会发送邮件但不会使用 php mail(),因为我不想共享我的 gmail 凭据。
试试这个:
How to configure XAMPP to send mail from localhost?
您可以使用其他邮件服务,而不仅仅是 gmail。稍后,当你有自己的服务器时,安装你的邮件服务器:)
我想在 ubuntu 上使用 xampp 使用 php mail() 函数发送电子邮件。但是它没有发送。请检查我的代码。我是否需要为其设置任何电子邮件服务器(如 gmail),或者我可以在没有 gmail 的情况下设置?
<?php
$address = "kthakkar@argusoft.com";
$subject = 'Test email';
$body = 'If you can read this, your email is working.';
echo "Attempting to email $address...<br />";
if (mail($address, $subject, $body)) {
echo 'SUCCESS! PHP successfully delivered email to your MTA. If you don\'t see the email in your inbox in a few minutes, there is a problem with your MTA.';
} else {
echo 'ERROR! PHP could not deliver email to your MTA. Check that your PHP settings are correct for your MTA and your MTA will deliver email.';
}
?>
如果我使用 smtp gmail 帐户,它会发送邮件但不会使用 php mail(),因为我不想共享我的 gmail 凭据。
试试这个: How to configure XAMPP to send mail from localhost?
您可以使用其他邮件服务,而不仅仅是 gmail。稍后,当你有自己的服务器时,安装你的邮件服务器:)