PHPMailer Setup

Hey guys, I could use some help trying to setup PHPmailer. I have a php website that uses the mail function to send an email. I can not figure how to set up my PHP.ini so that it uses phpmailer. I am using IIS 8 on Windows Server 2012 R2. I can send test emails fine with no issues, I just need to configure it correctly.

Appreciate any help

Granted I am not positive, but phpmailer is not handled through php.ini. It is a class that gets instantiated and called by a script.

You could have a wrapper class that could handle values passed much like mail() does, but they are not the same thing.

Watch this video - It has no connection to php.ini as [member=72272]astonecipher[/member] has mentioned.

Are you trying to mail out through IIS local SMTP Settings or relay through a different mail server?

Once you have PHPMailer setup I found out through trial and error this worked the best for me (if you’re running a local server to test out your scripts).

[php] if (filter_input(INPUT_SERVER, ‘SERVER_NAME’, FILTER_SANITIZE_URL) == “localhost”) {
$mail->isSmtp(); // Local Host:
$mail->Port = EMAIL_PORT; // Local Host Port: (Usually 587)
} else {
$mail->isSendMail(); // Remote Host:
}[/php]

A little background story about this part of the script, I notice one day that my remote server wasn’t sending out emails from my contact page or registration page. So after Googling, I found out that most remote email servers prefer $mail->isSendMail over $mail->isSmtp(). Hopefully this will prevent you some headaches.

Sponsor our Newsletter | Privacy Policy | Terms of Service