是否可以使用php mail()发送带有goddady服务器的电子邮件?

时间:2017-10-12 07:11:12

标签: php email shared-hosting

嘿家伙我在godaddy中托管我的网页,我试图用一个表格发送一个带有php的电子邮件,我有一个boostrap模板,他们写了表格和PHP代码(所以问题不在代码中)。

<form action="sendemail.php" method="POST" id="main-contact-form" name="contact-form">
            <div class="row  wow fadeInUp" data-wow-duration="600ms" data-wow-delay="150ms">
              <div class="col-sm-6">
                <div class="form-group">
                  <input type="text" name="name" class="form-control" placeholder="Nombre y Apellidos" required="required">
                </div>
              </div>
              <div class="col-sm-6">
                <div class="form-group">
                  <input type="email" name="email" class="form-control" placeholder="E-mail" required="required">
                </div>
              </div>
            </div>
            <div class="form-group">
              <input type="text" name="subject" class="form-control" placeholder="Asunto" required="required">
            </div>
            <div class="form-group">
              <textarea name="message" id="message" class="form-control" rows="4" placeholder="Escribe tu mensaje" required="required"></textarea>
            </div>                        
            <div class="form-group">
              <button type="submit" class="btn-submit">Enviar E-mail</button>
            </div>
          </form>

<?php
$name       = @trim(stripslashes($_POST['name'])); 
$from       = @trim(stripslashes($_POST['email'])); 
$subject    = @trim(stripslashes($_POST['subject'])); 
$message    = @trim(stripslashes($_POST['message'])); 
$to         = 'hola@farmaviten.com';//replace with your email

$headers   = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: {$name} <{$from}>";
$headers[] = "Reply-To: <{$from}>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();

mail($to, $subject, $message, $headers);

die;
?>

我已经在cPanel中设置了一个电子邮件帐户,在Workspace中设置了另一个电子邮件帐户(彼此不同)但我没有收到任何电子邮件。I also found in godaddy's forum some guys had the same problem and it got fixed by calling and telling them to turn on some "MX entries". Did the same and mine is still not working.

任何想法为什么不起作用?请我绝望

0 个答案:

没有答案