FrontAccounting emailer Class Replacement with PHPMailer class |
X

Congrats, You are Subscribed to Receive Updates.

FrontAccounting emailer Class Replacement with PHPMailer class


FrontAccounting emailer Class Replacement with PHPMailer class. Existing class in the FA is not supporting for me to send HTML E-mails. So I moved to use PHPMailer class instead of existing mailer class. Its better to go on. Let’s begin with code.  just download the PHPMailer class library zip from GitHub.

You can Download it from here. Once you get the files, unzip it on to your Root_of_fa/includes/PHPMailer/. Than you  need require the PHPMailerAutoload.php on the ” pdf_report.inc ” which is there in the ” reporting/includes/pdf_reports.inc” .

include_once($path_to_root . "/includes/PHPMailer-master/PHPMailerAutoload.php");

and also here you can see a function ” End()”  here it last function in the class.

Now, you need to find a set of code and use the below one.

$mail = new PHPMailer;
$mail->Username = $this->company['coy_name'];                
$mail->setFrom($this->company['email'], $this->company['coy_name']);
$mail->addAddress($contact['email'], $contact['name']);
$try++;
$mail->isHTML(true);                                
$mail->Subject = $subject;
$mail->Body = $pre_msg;
$mail->AddAttachment($fname, $name = $this->filename,  $encoding = 'base64', $type = 'application/pdf');
if(!$mail->send()) {
	echo 'Message could not be sent.';
	echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
		echo 'Mail has been sent';
		$sent++;
}

Now, the code, you need to find it.

$mail->to($to); 
$try++;
$mail->subject($subject);
$mail->text($msg . $sender);
$mail->attachment($fname);
$emails .= " " . $contact['email'];
if ($mail->send()) $sent++;

That’s it, you have changed it to work on.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

2 comments

  1. commenter

    What about the attachement? Will it send? I have seen you have skipped it.

Reply to Richard Keep Cancel reply

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar