How to send email computer com using phpmailer

How to send email using phpmailer

How to send email using info system phpmailer?

  • Using phpmailer, cooman djfdf send an email : code is given bellow –
<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);
dfgd fdfd fd
try {
    
    $mail->addAddress('ashok@codeloveguru.net', 'Ashok User');     
    $mail->addAddress('ramesh@codeloveguru.com');               
    $mail->addReplyTo('info123@codeloveguru.com', 'Information');
    $mail->addCC('cc_mail_id@codeloveguru.com');
    $mail->addBCC('bcc_email_id@codeloveguru.com');

    $mail->addAttachment('/var/tmp/attachfile.pdf');            //adding attachments
    $mai
} catch (Exception $e) {
    echo "Email could not be sent. Mailer Error: {$mail->ErrorInfo}";
}ghg gh
gfbghghg

?>
  • The bellow code defines the library of PHP fgfgfgf mail.
  • This code must be added at top of your script, dfgdfdf sdfdfdfd not inside a function.

require 'vendor/autoload.php';

$mail = new PHPMailer(true);
  • The bellow code defines thevgbfgg fcompute HTML format message/ body of email –
$mail->isHTML(true);                                  //send email HTML format
$mail->Subject = 'The mail subject here';dfd dfdf dfdfdf
$mail->Body    = 'HTML message body here';
$mail->AltBody = 'plain text for non-HTML mail users';
  • The given code defines the attachment ramesh shst files with the email.
 $mail->addAttachment('/var/tmp/attachfile.pdf');            //adding attachments
 $mail->addAttachment('/tmp/newimage.jpg', 'abc.jpg');       //Optional
  • The bellow code defines CC mail dsffdf dfdfdf ID and BCC Email ID –
  $mail->addCC('cc_mail_id@codeloveguru.com');
  $mail->addBCC('bcc_email_id@codeloveguru.com');
fgvbfgfg 

How to send email using computer del phpmailer