邮件没有发送到我的网站godaddy工作区

时间:2014-05-02 11:18:06

标签: php email

        <?php
        if($_REQUEST['submit']=='SEND'){

        $to= 'info@mysatoristudio.com,aespino@brainwaveadvertising.com,sales@mpsinfoservices.com,tamali@mpsinfoservices.com,tathagata@mpsinfoservices.com,tamali@mysatoristudio.com';

        /* $to='ananya@mpsinfoservices.com';*/
        $mailmessage = '
        <html>
        <head>
        <title>Contact Us</title>
        </head>
        <body>
        <table width="80%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td colspan="2">
        </td>
        <tr>
        <tr>
        <td colspan="2">You have Successfully registerd for "Satori studio"</td>
        </tr>
        <tr>
        <td colspan="2">Your Name : '.$_REQUEST['name'].'</td>
        </tr>
        <tr>
        <td colspan="2">Your mail ID : '.$_REQUEST['email'].'</td>
        </tr>
        <tr>
        <td colspan="2">&nbsp;</td>
        </tr>
        </table>
        </body>
        </html>
        ';
        $headers  = "MIME-Version: 1.0"."\r\n";
        $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
        /*  $headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n";*/
        $headers .= "From: Satori studio <info@mysatoristudio.com>" . "\r\n";
        $subject = 'Registration for "Satori studio"';

        mail($to,$subject,$mailmessage,$headers);
        header("Location:index.php?msg=seccess");
        }
        ?>

邮件从我的网站发送到每个邮件服务器,如谷歌,雅虎等...但不是在godaddy工作区邮件ID ...这是一个编码问题???或其他...请建议...

1 个答案:

答案 0 :(得分:0)

我通过添加

来实现这一目标
ini_set('SMTP', "relay-hosting.secureserver.net");
ini_set('smtp_port', "25");

在调用mail函数之前,如下所示:

public function sendEmail( $text , $subject , $name , $sender_email , $destination )
{
    $headers="From:$name <$sender_email>\r\n"; 
    $headers .= "Reply-To: $sender_email\r\n"; 
    $headers .= "Date: " . date("r") . "\r\n"; 
    $headers .= "Return-Path: $sender_email\r\n"; 
    $headers .= "MIME-Version: 1.0\r\n"; 
    $headers .= "Message-ID: " . date("r") . $name ."\r\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    $headers .= "X-Priority: 1\r\n"; 
    $headers .= "Importance: High\r\n"; 
    $headers .= "X-MXMail-Priority: High\r\n"; 
    $headers .= "X-Mailer: PHP Mailer 1.0\r\n"; 

    ini_set('SMTP', "relay-hosting.secureserver.net");
    ini_set('smtp_port', "25");

    mail( $destination , $subject , $text , $headers ); 

    return true;
}

我还注意到邮件仅在使用charset=iso-8859-1时发送,

我认为在godaddy工作区的服务器配置中可能缺少一些东西,它不允许通过邮件使用utf-8字符集。如果你真的需要utf-8字符集,我认为这种支持可能会有所帮助。