ใช้ phpmailer account gmail แต่ติดว่า server ต้องใช้ proxy จะเซ็

ตัว server ต้องใช้ proxy ในการออกอินเตอร์เน็ตครับ เวลาส่งเมล์มันจะฟ้องว่า



Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (php_network_getaddresses: getaddrinfo failed: No such host is known. )



อยากรู้วิธีทำให้ส่งเมล์ได้โดยผ่าน proxy รบกวนขอคำแนะนำด้วยครับ



<?php

        require_once ('class.phpmailer.php');



        $mail = new PHPMailer(true);

        $mail->IsSMTP(); // telling the class to use SMTP

        try {

            $mail->Encoding = "quoted-printable";

            $mail->CharSet = "utf-8";

           

            // send mail by gmail

            $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 = $gmail_username// GMAIL username

            $mail->Password = $gmail_password// GMAIL password

            

            $mail->AddReplyTo($mailform, $mailform);

            $mail->AddAddress($mailto, $mailto);

            $mail->SetFrom($mailform, $mailform);

            $mail->Subject = $subject;

            $mail->MsgHTML($msg);

            $mail->Send();

        }

        catch (phpmailerException$e) {

            echo $e->errorMessage(); //Pretty error messages from PHPMailer

        }

        catch (Exception $e) {

            echo $e->getMessage(); //Boring error messages from anything else!

        }

?>
28 พ.ค. 2555 1 2,869

Server ต้องเปิดการใช้งาน ssl ด้วยครับ
#1
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^