Search
 
SCRIPT & CODE EXAMPLE
 

PHP

SMTP -> ERROR: Failed to connect to server: Connection refused (111)SMTP Connect() failed.

<?php
    include "emails/PHPMailer/PHPMailerAutoload.php"; 
	//or just include the phpMailer
    //Create a new PHPMailer instance
    $mail = new PHPMailer(); 

    $mail->IsSMTP(); 
    $mail->SMTPDebug = 1; 
    $mail->SMTPAuth = true; 
    $mail->SMTPSecure = 'ssl'; 
    $mail->Host = "smtp.gmail.com";

    $mail->Port = 465; 
    $mail->IsHTML(true);
    //Username to use for SMTP authentication
    $mail->Username = "@gmail.com";
    $mail->Password = "";
    //Set who the message is to be sent from
    $mail->setFrom('mzubim@gmail.com', 'Zubair Mushtaq');
    //Set an alternative reply-to address
    $mail->addReplyTo('replyto@gmail.com', 'Secure Developer');
    //Set who the message is to be sent to
    $mail->addAddress('abulogics@gmail.com', 'Abulogicss');
    //Set the subject line
    $mail->Subject = 'PHPMailer 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("convert HTML into a basic plain-text alternative body");
    //Replace the plain text body with one created manually
    $mail->AltBody = 'This is a plain-text message body';

    //send the message, check for errors
    if (!$mail->send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Message sent!";
    }
Comment

PREVIOUS NEXT
Code Example
Php :: ver version de php en linux 
Php :: laravel soft delete example 
Php :: laravel exist 
Php :: php connect strings 
Php :: laravel override factory values in database seeder 
Php :: php array order alphabetically 
Php :: phpspreadsheet CellProtection 
Php :: php var_dump more readable 
Php :: php check if string ends with 
Php :: Adding JavaScript to a Specific WordPress Page Using Code In Header 
Php :: replace text in string php 
Php :: laravel factory 
Php :: woocommerce hook after order placed 
Php :: wp php get product item attributes name 
Php :: wordpress reserved image size names 
Php :: how naming resource routes laravel 
Php :: php password verify 
Php :: laravel casts 
Php :: make exception laravel 
Php :: laravel migrate test environment 
Php :: php check if parameter exists in url 
Php :: wordpress custom post type query 
Php :: php add variable to array 
Php :: laravel model withCount relationship condition 
Php :: eloquent where comparing two columns 
Php :: Sum two numbers in PHP with HTML input form 
Php :: php regex replace to remove special characters and accented 
Php :: switch php versions 
Php :: update column type laravel migration 
Php :: php append n time pattern to string 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =