SMTP /邮件程序无法正常工作

时间:2014-08-21 14:21:27

标签: php email smtp gmail mailer

我的邮件或SMTP有一些问题我不知道,'因为我没有。 它在网上工作得很好,我填写我的详细信息(姓名,电子邮件,消息)和点击提交按钮,它的消息已经发送,但是当我检查我的gmail acc时,没有消息。 以下是我的代码:

    <div id="contact">
    <h1>CONTACT ME!</h1>
    <form method="POST" action="">
        <input type="text" placeholder="First & Last name.." name="name" required>
        <input type="email" placeholder="Enter your email..." name="email" required>
        <textarea placeholder="Your message..." name="message" required></textarea>
        <input type="submit" value="SEND" name="button">
    </form>
<?php 
if(isset($_POST['button'])){
    $to = "roodrd@gmail.com";  
$subject = "Contact form test";  
$email = isset($_POST['email']) ;  
$message = isset($_POST['message']);  
$headers = "From: $email";  
$sent = mail($to, $subject, $message, $headers) ;  
if($sent)  {
    echo "Your mail was sent successfully"; 
} else  {
    echo "We encountered an error sending your mail"; 
}

    }

&GT;

的php.ini

    [mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = roodrd@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

sendmail.php(这就是我所拥有的所有内容)

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=roodrd@gmail.com
auth_password=MYPASSWORD
force_sender=roodrd@gmail.com

抱歉英语不好,只知道我正在使用XAMPP。

0 个答案:

没有答案
相关问题