Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

phpmailer with laravel

<?php
namespace AppHttpControllers;

use PHPMailerPHPMailer;

class testPHPMailer extends Controller
{
    public function index()
    {
        $text             = 'Hello Mail';
        $mail             = new PHPMailerPHPMailer(); // create a n
        $mail->SMTPDebug  = 1; // debugging: 1 = errors and messages, 2 = messages only
        $mail->SMTPAuth   = true; // authentication enabled
        $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
        $mail->Host       = "smtp.gmail.com";
        $mail->Port       = 465; // or 587
        $mail->IsHTML(true);
        $mail->Username = "testmail@gmail.com";
        $mail->Password = "testpass";
        $mail->SetFrom("testmail@gmail.com", 'Sender Name');
        $mail->Subject = "Test Subject";
        $mail->Body    = $text;
        $mail->AddAddress("testreciver@gmail.com", "Receiver Name");
        if ($mail->Send()) {
            return 'Email Sended Successfully';
        } else {
            return 'Failed to Send Email';
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #phpmailer #laravel
ADD COMMENT
Topic
Name
4+7 =