phpmailerHow do I set up PHPMailer to use a specific port?
To set up PHPMailer to use a specific port, the following steps should be taken:
- Include the PHPMailer library in your project.
 
require 'PHPMailer/PHPMailerAutoload.php';
- Create a new instance of the PHPMailer class.
 
$mail = new PHPMailer;
- Set the port that you wish to use.
 
$mail->Port = 465;
- Set the encryption type to use for the port.
 
$mail->SMTPSecure = 'ssl';
- Connect to the SMTP server using the provided port and encryption type.
 
$mail->Host = 'smtp.example.com';
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
- Send the mail using the 
send()method. 
$mail->send();
- Check for errors.
 
if (!$mail->send()) {
    echo 'Mailer Error: ' . $mail->ErrorInfo;
}
Helpful links
More of Phpmailer
- How can I use PHPMailer to send emails through Outlook?
 - How can I configure PHPMailer to support Polish characters?
 - How can I use PHPMailer with XAMPP on a localhost?
 - How can I use PHPMailer without SMTP secure?
 - How do I use PHPMailer with OAuth 2.0?
 - How do I configure the timeout settings for PHPMailer?
 - How can I send emails using PHPMailer without using SMTP?
 - How do I determine which version of PHPMailer I'm using?
 - How do I use PHPMailer to attach a ZIP file?
 - How can I use PHPMailer in Yii 1?
 
See more codes...