Setting Up PHPMailer On Linux
Page 1 of 1
Setting Up PHPMailer On Linux
Vid
Setup:
navigate to /var/www/html folder then run this
type:
then goto correct folder
type:
Now to use the script correctly
Usage Notes:
make sure the 2 firsts lines are at the top of document!!
Setup:
navigate to /var/www/html folder then run this
- Code:
cd /var/www/html
type:
- Code:
composer require phpmailer/phpmailer
then goto correct folder
- Code:
cd /var/www/html/vendor/phpmailer/phpmailer
type:
- Code:
composer require league/oauth2-google
Now to use the script correctly
Usage Notes:
make sure the 2 firsts lines are at the top of document!!
- Code:
use PHPMailer\PHPMailer\PHPMailer;
require("../../vendor/autoload.php");
Re: Setting Up PHPMailer On Linux
Basic Script
For latest scripts for php mailer
alexwebdevelop.com/phpmailer-tutorial
- Code:
<?php
ini_set("display_errors", "0");
error_reporting(E_ALL);
use PHPMailer\PHPMailer\PHPMailer;
require("../../vendor/autoload.php"); //Needs to be correct relative to the autoload.php file!
$mail=new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug=0; // 2 is default
$mail->Host='smtp.gmail.com';
$mail->Port=587;
$mail->SMTPAuth=true;
$mail->Username='email@domain.com';
$mail->Password='password';
$mail->setFrom('email@domain.com', 'JNET');
$mail->addReplyTo('email@domain.com', 'JNET');
$mail->addAddress('email@domain.com', 'Jay');
$mail->Subject='Testing PHPMailer';
//$mail->msgHTML(file_get_contents('message.html'), __DIR__);
$mail->Body='This is a plain text message body';
//$mail->addAttachment('test.txt');
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'The email message was sent.';
}
?>
For latest scripts for php mailer
alexwebdevelop.com/phpmailer-tutorial
Similar topics
» Linux Bash Setting Var & Fallback Var Setting With User Input
» setting up ssh on linux
» Setting Up D-Trace For Linux
» Setting Up Conky For Linux
» Setting the date in Linux from the CLI
» setting up ssh on linux
» Setting Up D-Trace For Linux
» Setting Up Conky For Linux
» Setting the date in Linux from the CLI
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|