PHPMailer无法仅在localhost上实例化

时间:2016-09-29 01:00:33

标签: php apache xampp phpmailer

我有这个奇怪的问题,我找不到任何正确的解决方法。我使用端口8080或localhost:8080作为我的端口,因为端口80已经被使用,我不知道在这种情况下php.ini是否有区别。这是我的代码:

    require("../../PHPMailer/PHPMailerAutoload.php");

    //PHPMailer Object
    $mail = new PHPMailer;

    //From email address and name
    $mail->From = "rangeles@guess.com.ph";
    $mail->FromName = "Raquel Angeles";

    //To address and name
    $mail->addAddress("jabril@guess.com.ph"); //Recipient name is optional

    //Address to which recipient will reply
    $mail->addReplyTo("reply@yourdomain.com", "Reply");

    //CC and BCC
    //$mail->addCC("cc@example.com");
    //$mail->addBCC("bcc@example.com");

    //Send HTML or Plain Text email
    $mail->isHTML(true);

    $mail->Subject = "Subject Text";
    $mail->Body = "<i>Mail body in HTML</i>";
    $mail->AltBody = "This is the plain text version of the email content";

    if(!$mail->send()) 
    {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } 
    else 
    {
        echo "Message has been sent successfully";
    }

我的php.ini是这样的:

[mail function]
; For Win32 only.
SMTP=localhost
smtp_port=25

谢谢你们的帮助!

0 个答案:

没有答案