Php电子邮件SMTP设置 [英] Php email SMTP settings
问题描述
您好,要自动从PHP表单发送电子邮件,我在php.ini中进行了这些更改
[邮件功能]
;仅适用于Win32。
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 465
auth_username = ****@gmail.com
auth_password = ****
sendmail_from = ****@gmail.com
sendmail_path =C :\ xampp \ sendmail \ sendmail.exe \ -t
在sendmail.ini中
SMTP = smtp.gmail.com
smtp_port = 465
auth_username = ****@gmail.com
auth_password = ****
force_sender = **** @ gmail.com
一切顺利我收到消息发送成功...消息但是我的gmail我没有收到任何邮件。
请给出你的建议
我尝试过:
<?php
$ to =*******@gmail.com;
$ subject =这是主题;
$ message =这是HTML消息。 ;
$ message。=
这是标题。
;$ header =From:* ***@gmail.com \\\\ n;
$ header。=MIME-Version:1.0\\ n; < br $>
$ header。=Content-type:text / html\r\ n;
$ retval = mail($ to,$ subject,$ message,$标题);
if($ retval == true){
echo消息发送成功...;
}否则{
echo无法发送消息......;
}
?>
to =*******@gmail.com;
subject =这是主题;
message =这是HTML消息。;
Hello, To send an email from PHP form automatically I made these changes in php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=smtp.gmail.com
; http://php.net/smtp-port
smtp_port=465
auth_username = ****@gmail.com
auth_password = ****
sendmail_from = ****@gmail.com
sendmail_path ="C:\xampp\sendmail\sendmail.exe\ -t"
In sendmail.ini
SMTP=smtp.gmail.com
smtp_port=465
auth_username = ****@gmail.com
auth_password = ****
force_sender=****@gmail.com
everything is going well I am getting Message sent successfully...message but to my gmail I am not getting any mail.
Please give your suggestions
What I have tried:
<?php
$to = "*******@gmail.com";
$subject = "This is subject";
$message = "This is HTML message.";
$message .= "
This is headline.
";$header = "From:****@gmail.com \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ) {
echo "Message sent successfully...";
}else {
echo "Message could not be sent...";
}
?>
to = "*******@gmail.com";
subject = "This is subject";
message = "This is HTML message.";
这篇关于Php电子邮件SMTP设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!