0

私は共有ホスティングプランを利用しており、PHPを使用してメールを送信すると、メールクライアント(Gmailなど)がフィールドに少し追加され、ホストのドメインがそこに含まれviaます。from

したがって、私のメールが私のドメインからのものである代わりに:

From: me@mydomain.com

これは2つのドメインからのものです。

From: me@mydomain.com via host13.myhost.com

明らかに、これは電子メールを受信する人々を混乱させ、ブランディングが不十分です。私は共有ホスティングプランを利用しているので、PHPの構成設定やメールで使用するものにアクセスできる可能性は低いと思います。PHPメールにデジタル署名することは可能ですか、それとも共有ホスティングでは不可能ですか?

これが私が今していることです:

$header = "From: me@mydomain.com";
mail("you@yourdomain.com", "subject", "body", $header);
4

2 に答える 2

1

これを試すことができます。ここから PHP Mailer クラスをダウンロードする必要があります。コードは次のようになります。

 <?php
include "PHP MAILER CLASS";
    $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
    $mail->IsSMTP(); // telling the class to use SMTP
    try {
        //$mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
        $mail->SMTPAuth   = true;                  // enable SMTP authentication
        $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
        $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
        $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
        $mail->Username   = "example@gmail.com";  // GMAIL username
        $mail->Password   = "password";            // GMAIL password
        $mail->AddAddress("Reciever Email", "Reciever Name");
        $mail->SetFrom('Sender Email', 'Sender Name');
        $mail->Subject = "Subject";
        $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
        $mail->MsgHTML("Message Body");
        $mail->Send();
    } catch (phpmailerException $e) {
        $e->errorMessage(); //Pretty error messages from PHPMailer
    } catch (Exception $e) {
        $e->getMessage(); //Boring error messages from anything else!
    }
    ?>
于 2013-03-12T03:59:10.840 に答える
0

デフォルトのメール機能はサーバーの設定に左右され、受信者にとって通常のメールのように見えることはめったにありません。SwitfMailerまたはpear MAILのいずれかのライブラリを使用して、SMTP 経由で独自のメール サーバーを介してメールを送信する必要があります。通常の電子メール アカウントを使用することも、Web サービス用に新しいアカウントをセットアップすることもできます。

于 2013-03-12T04:03:37.830 に答える