Search
 
SCRIPT & CODE EXAMPLE
 

PHP

enable phpmailer cpanel

<?phpuse PHPMailerPHPMailerPHPMailer;use PHPMailerPHPMailerException;require '/home/cpanelusername/PHPMailerTest/PHPMailer/src/Exception.php';require '/home/cpanelusername/PHPMailerTest/PHPMailer/src/PHPMailer.php';require '/home/cpanelusername/PHPMailerTest/PHPMailer/src/SMTP.php';// Instantiation and passing [ICODE]true[/ICODE] enables exceptions$mail = new PHPMailer(true);try { //Server settings $mail->SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'user@example.com'; // SMTP username $mail->Password = 'secret'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, [ICODE]ssl[/ICODE] also accepted $mail->Port = 587; // TCP port to connect to//Recipients $mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('recipient1@example.net', 'Joe User'); // Add a recipient $mail->addAddress('recipient2@example.com'); // Name is optional $mail->addReplyTo('info@example.com', 'Information'); $mail->addCC('cc@example.com'); $mail->addBCC('bcc@example.com');// Attachments $mail->addAttachment('/home/cpanelusername/attachment.txt'); // Add attachments $mail->addAttachment('/home/cpanelusername/image.jpg', 'new.jpg'); // Optional name// Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body <b>in bold!</b>'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';$mail->send(); echo 'Message has been sent';} catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";}
Comment

PREVIOUS NEXT
Code Example
Php :: socket io laravel 
Php :: echo foreach 
Php :: how to run php on windows 
Php :: laravel request not returning errors 
Php :: php vs python speed 
Php :: laravel dependency injection 
Php :: get data from stdclass object php 
Php :: how to split sting in php 
Php :: indexing in database laravel 
Php :: laravel blade for if 
Php :: dont insert duplicate data in laravel 
Php :: how to catch duplicate entry to database in laravel 
Php :: PHP if...else...elseif Statements 
Php :: how to lookup value inside object php 
Php :: php array lenght 
Php :: php loop object keys 
Php :: extract in php useful 
Php :: xampp php ini 
Php :: php increment variable by 1 
Php :: inner pages not found yii 
Php :: laravel scheduler every 10 minutes 
Php :: woocommerce_rest_cannot_view 
Php :: @forelse laravel 
Php :: WordPress Image/Files uploads 
Php :: php get sql update from session 
Php :: Befreie den WordPress-Header von unnötigen Einträgen 
Php :: mysql php update sum same table 
Php :: laravel restore deleted 
Php :: $s = [1,2,3] for loop use in php 
Php :: Nginx + Laravel - Moving blog from subdomain to /blog 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =