来自Godaddy服务器的php mail()

| 我正在使用godaddy托管我的网站并使用默认的godaddy邮件服务。 现在,我想使用php邮件功能将电子邮件从godaddy \电子邮件帐户的15个电子邮件地址中的1个发送到其他电子邮件地址 我该如何确定从哪个电子邮件地址发送电子邮件,以及如何放置该电子邮件地址的用户名和密码? 谢谢     
已邀请:
        与其使用仅调用OS邮件功能(即sendmail)的mail()函数,不如尝试SwiftSwift(免费的PHP邮件库)之类的东西。它支持许多不同的发送邮件的方式,包括登录到邮件帐户和发送电子邮件,就像在您自己的计算机上一样。您甚至可以根据需要从Gmail帐户发送电子邮件。 http://swiftmailer.org/     
        PHP的“ 0”功能使用为该Web主机配置的邮件服务器。您无法更改。由于Godaddy控制着邮件服务器,因此它们可以控制发送的邮件头。您可以尝试插入自定义
From
标头,但我怀疑这样做是否可行。它将被修改,标记为垃圾邮件或被拒绝。 如果您在Godaddy拥有15个帐户,也许是时候寻找更严肃的托管解决方案了?     
        我正在使用Godaddy托管。只需将某些字段保留为空白并发送邮件即可。 请参阅下面的代码,它为我工作。
<?php
include(\"class.phpmailer.php\");
function sendMail($address,$username,$body){
            $mail = new PHPMailer();
            $mail->IsSMTP(); // telling the class to use SMTP
            //$mail->Host       = \"smtp.gmail.com\"; // SMTP server
            $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                                // 1 = errors and messages
                                                                           // 2 = messages only
            // $mail->SMTPAuth   = true;                  // enable SMTP authentication
            // $mail->SMTPSecure = \"ssl\";                 // sets the prefix to the servier
            // $mail->Host       = \"smtp.gmail.com\";      // sets  as the SMTP server
            // $mail->Port       = 465;                   // set the SMTP port for the server
            // $mail->Username   = \"xyz@gmail.com\";  // username
            // $mail->Password   = \"test121232\";            // password

            $mail->SetFrom(\'contact@example.co.in\', \'Contact\');

            $mail->Subject    = \"Enquiry for tour and travels package\";



            $mail->MsgHTML($body);

            $address = $address;
            $mail->AddAddress($address, $username);
            $mail->AddCC(\'contact@example.co.in\');

            if(!$mail->Send()) {
            echo \"Mailer Error: \" . $mail->ErrorInfo;
            } else {
            echo \"Message sent!\";
            }
}

?>
刚刚更改了电子邮件地址,因此您可以通过此电子邮件ID发送邮件。
$mail->SetFrom(\'youremail@example.co.in\', \'Contact\');
    

要回复问题请先登录注册