2015年11月10日 星期二

PHPMailer

https://github.com/PHPMailer/PHPMailer


  •   git clone "https://github.com/PHPMailer/PHPMailer"  
  •   sudo nano  /mikelin/email.php  

    // Comment
    isSMTP();
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    $mail->SMTPDebug = 0;
    //Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';
    //Set the hostname of the mail server
    $mail->Host = 'smtp.gmail.com';
    // use
    // $mail->Host = gethostbyname('smtp.gmail.com');
    // if your network does not support SMTP over IPv6
    //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
    $mail->Port = 587;
    //Set the encryption system to use - ssl (deprecated) or tls
    $mail->SMTPSecure = 'tls';
    //Whether to use SMTP authentication
    $mail->SMTPAuth = true;
    //Username to use for SMTP authentication - use full email address for gmail
    $mail->Username = "XXX@gmail.com";
    //Password to use for SMTP authentication
    $mail->Password = "XXX_pw";
    //Set who the message is to be sent from
    $mail->setFrom('XXX@gmail.com');
    //Set an alternative reply-to address
    $mail->addReplyTo('XXX@gmail.com');
    //Set who the message is to be sent to
    $mail->addAddress('YYY@gmail.com');
    //Set the subject line
    $mail->Subject = 'PHPMailer GMail SMTP test';
    //Read an HTML message body from an external file, convert referenced images to embedded,
    //convert HTML into a basic plain-text alternative body
    $mail->msgHTML(file_get_contents('/home/mikelin/PHPMailer/examples/contents.html'), dirname(__FILE__));
    //$mail->msgHTML("hello");
    //Replace the plain text body with one created manually
    $mail->AltBody = 'This is a plain-text message body';
    //Attach an image file
    $mail->addAttachment('/home/mikelin/PHPMailer/images/phpmailer_mini.png');
    //send the message, check for errors
    if (!$mail->send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Message sent!";
    }
  • ERROR: Please log in via your web browser and then try again. 534-5.7.14
  • enable "Access for less secure apps",https://www.google.com/settings/security/lesssecureapps
  • Contents.html


  
  PHPMailer Test


Please click the alert to view the open data.

PHPMailer rocks
Scrapying is Wrong!.
PLASH ANTS TEAM




沒有留言:

張貼留言