php
  • email
  • gmail
  • 2017-07-19 56 views 0 likes 
    0

    メールが正常に動作していますが、メールを送信した後にGmailで不明な送信者エラーが表示されることがあります。私のPHPコードは次のとおりです。電子メールを送信php

    $sendto="[email protected]"; 
    $subject = "Payment details of ".$dmail['name']; 
    
    $message = "<br><br>"; 
    
    $message .= '<table border="0" cellspacing="5" cellpadding="4" width="600"style="border-collapse:collapse; font-family:Lucida Sans; border-color:#CCCCCC"> 
    
          <tr style="background-color:#023564; color:#FFF;"> 
          <td colspan="2"><h3 align="center">Registration Information From Midterm Delhi CSI 2017</h3></td> 
         </tr> 
          <tr> 
            <td width="54%"><p>Name</p></td> 
            <td width="46%"><p>'.$dmail['name'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Age</p></td> 
            <td width="46%"><p>'.$dmail['age'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Institution</p></td> 
            <td width="46%"><p>'.$ucomp.'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Designation</p></td> 
            <td width="46%"><p>'.$dmail['designation'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Postal Address</p></td> 
            <td width="46%"><p>'.$dmail['address'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>City</p></td> 
            <td width="46%"><p>'.$dmail['city'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>State</p></td> 
            <td width="46%"><p>'.$dmail['state'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Pin</p></td> 
            <td width="46%"><p>'.$dmail['pin'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Country</p></td> 
            <td width="46%"><p>'.$dmail['country'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Phone (Off).</p></td> 
            <td width="46%"><p>'.$dmail['phone_off'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Phone (Res).</p></td> 
            <td width="46%"><p>'.$dmail['phone_res'].'</p></td> 
           </tr> 
            <tr> 
            <td width="54%"><p>Mobile No</p></td> 
            <td width="46%"><p>'.$dmail['phone'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>E-mail</p></td> 
            <td width="46%"><p>'.$email.'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Gender</p></td> 
            <td width="46%"><p>'.$dmail['gender'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>Food Preference</p></td> 
            <td width="46%"><p>'.$dmail['dite'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>CSI Number</p></td> 
            <td width="46%"><p>'.$dmail['ioa_membership_no'].'</p></td> 
           </tr> 
           <tr> 
            <td width="54%"><p>MCI Number</p></td> 
            <td width="46%"><p>'.$csi.'</p></td> 
           </tr> 
    
            </table>'; 
    
    
        $username=$dmail['name']; 
        $header = "MIME-Version: 1.0\r\n"; 
        $header .= "Content-type: text/html\r\n"; 
        $header .= "From: ".$username."\r\n"; 
        $header .="\r\n"; 
    
        $retval = mail ($sendto,$subject,$message,$header); 
        return $retval; 
    
    +2

    電子メールメッセージの送信者がメッセージではなく、メッセージが送られているアドレスを送っ一つです... – arkascha

    +2

    '$ username'に何が私はそれが電子メールアドレスではないと思います – RiggsFolly

    +1

    $ usernameとしてから与えません。ちょうど[email protected]を与える –

    答えて

    1

    返信先のヘッダーを追加してみてください。

    $header .= 'From: [email protected]' . "\r\n"; 
    $header .= 'Reply-To: [email protected]' . "\r\n"; 
    

    または名前を持つ:

    $header .= 'From: "From Name" <[email protected]>' . "\r\n";  
    $header .= 'Reply-To: "From Name" <[email protected]>' . "\r\n"; 
    
    +1

    正しい「From:」アドレスはより良い考えになります – RiggsFolly

    +1

    FromとReply-Toの両方を使用することをお勧めします。 – MVG1984

    +1

    しかし、「From:」アドレスがエラーの理由のように見えるので、最初にそれに対処するほうがよいでしょう – RiggsFolly

    関連する問題