如何在php邮件程序脚本中使用谷歌加密邮件端口

时间:2018-02-22 10:05:10

标签: javascript php phpmailer

[我的代码运行完美,但 ENCRYPTED 所以我想知道,如何在加密中使用此方法。 (我的邮件服务器由谷歌提供)



SELECT Emp_NO, Name, ReportingID
FROM Reslookup
WHERE ReportingID = <desired ID>
&#13;
&#13;
&#13;

所以现在我想在那个邮件上删除问号标识。

1 个答案:

答案 0 :(得分:0)

我在下面提到了我的问题的答案:

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;

}