简体   繁体   中英

how to use google encrypted mail port in php mailer scripts

[I have my code which running perfectly but not ENCRYPTED so I want to know, How to use this method with Encryption. (my mail server is provided by Google)

 function sendMail($applicationID){ $host = 'localhost'; $user = 'username'; $pass = 'password'; $db = 'database'; $conn = mysqli_connect($host,$user,$pass,$db) or die("Error ". mysqli_connect_error()). PHP_EOL; $distributor_details = mysqli_fetch_assoc(mysqli_query($conn,"select * from distributor where status = '1' and deleted IS NULL and id = '$applicationID' limit 0,1 ")); if(isset($distributor_details['id'])){ $state=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_state where id='".$distributor_details['state']."' ")); $country=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_country where id='".$distributor_details['country']."' ")); /*<tr> <th height="25">Application ID:</th><td>'.distributorNumber($distributor_details['id']).'</td> </tr>*/ $message = '<html> <head> <title>Triveni Almirah</title> </head> <body> <h1>Dealer/Distributor Enquiry Details</h1> <table cellspacing="0" style="border: 2px dashed #3c8dbc; width: 100%; height: auto;"> <tr style="background-color: #e0e0e0;"> <th height="25">Name:</th><td>'.stripslashes(strtoupper($distributor_details['fname'])).'</td> </tr> <tr> <th height="25">Email Id:</th><td>'.$distributor_details['email'].'</td> </tr> <tr style="background-color: #e0e0e0;"> <th height="25">Mobile:</th><td>'.$distributor_details['mobile'].'</td> </tr> <tr> <th>Address:</th><td>'.strtoupper($distributor_details['city']).'</td> </tr> <tr> <th height="25">Comments:</th><td>'.$distributor_details['comment'].'</td> </tr> <tr style="background-color: #e0e0e0;"> <th height="25">Posted Date:</th><td>'.date("dmY",strtotime($distributor_details['post_date'])).'</td> </tr> </table> </body> </html>'; $headers = "MIME-Version: 1.0;\\n"; $headers .= "Content-type: text/html; charset=iso-8859-1;\\n"; $headers.='From:HIRDESH - VASHISHTHA <noreply@domain.com>' . "\\r\\n".PHP_EOL; //$headers.='CC: abcd48@gmail.com' . "\\r\\n".PHP_EOL; //$port = 587; //$auth = true; //echo $message; die; mail("data@domain.com","Distributorship Enquiry",$message,$headers); } return true; }

So now i want to remove logo of Question-mark on that Mails.

I found a Answer of my Question that is mention below:

function sendMail($applicationID){
$host = 'localhost'; 
$user = 'username'; 
$pass = 'password'; 
$db = 'database';
$conn = mysqli_connect($host,$user,$pass,$db)  or die("Error ". mysqli_connect_error()). PHP_EOL;
$distributor_details = mysqli_fetch_assoc(mysqli_query($conn,"select * from distributor where status = '1' and deleted IS NULL and id = '$applicationID' limit 0,1 "));
if(isset($distributor_details['id'])){
    $state=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_state where id='".$distributor_details['state']."' "));
    $country=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_country where id='".$distributor_details['country']."' "));
    /*<tr>
                        <th height="25">Application ID:</th><td>'.distributorNumber($distributor_details['id']).'</td>
                    </tr>*/
    $message = '<html>
            <head>
                <title>Triveni Almirah</title>
            </head>
            <body>
                <h1>Dealer/Distributor Enquiry Details</h1>
                <table cellspacing="0" style="border: 2px dashed #3c8dbc; width: 100%; height: auto;">
                    <tr style="background-color: #e0e0e0;">
                        <th height="25">Name:</th><td>'.stripslashes(strtoupper($distributor_details['fname'])).'</td>
                    </tr>
                    <tr>
                        <th height="25">Email Id:</th><td>'.$distributor_details['email'].'</td>
                    </tr>
                    <tr style="background-color: #e0e0e0;">
                        <th height="25">Mobile:</th><td>'.$distributor_details['mobile'].'</td>
                    </tr>
                    <tr>
                        <th>Address:</th><td>'.strtoupper($distributor_details['city']).'</td>
                    </tr>
                    <tr>
                        <th height="25">Comments:</th><td>'.$distributor_details['comment'].'</td>
                    </tr>
                    <tr style="background-color: #e0e0e0;">
                        <th height="25">Posted Date:</th><td>'.date("d-m-Y",strtotime($distributor_details['post_date'])).'</td>
                    </tr>
                </table>
            </body>
            </html>';
    $headers  = "MIME-Version: 1.0;\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1;\n"; 
    $headers.='From:HIRDESH - VASHISHTHA <noreply@domain.com>' . "\r\n".PHP_EOL;
    //$headers.='CC: abcd48@gmail.com' . "\r\n".PHP_EOL;
    $port = 587;
    $SMTPAuth = true;
    //echo $message; die;
    mail("data@domain.com","Distributorship Enquiry",$message,$headers,$SMTPAuth);  
}
return true;

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM