Instead of using CodIgniter Email class, we could instead integrate PHPMailer which you could download from here. In this way we could specify how our body is to be decoded.
Step 1. Download PHPMailer
Github pageStep 2. Paste PHPMailer to CodeIgniter
Go ahead and extract the zip file then copy it to "application/libraries".Step 3. Create a Controller
Create a controller and name it with "Email.php".<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Email extends CI_Controller { function __construct(){ parent::__construct(); $this->load->library('phpmailer'); } function send_email() { $response = false; $mail = new PHPMailer(); $subject = 'Test subject'; $body = 'Hi there, <strong>Carl</strong> here.<br/> This is our email body.'; $email = 'reciever@example.com'; $mail->CharSet = 'UTF-8'; $mail->SetFrom('kodingmadesimple@gmail.com','Carl'); //You could either add recepient name or just the email address. $mail->AddAddress($email,"Recepient Name"); $mail->AddAddress($email); //Address to which recipient will reply $mail->addReplyTo("reply@yourdomain.com","Reply"); $mail->addCC("cc@example.com"); $mail->addBCC("bcc@example.com"); //Add a file attachment $mail->addAttachment("file.txt", "File.txt"); $mail->addAttachment("images/profile.png"); //Filename is optional //You could send the body as an HTML or a plain text $mail->IsHTML(true); $mail->Subject = $subject; $mail->Body = $body; //Send email via SMTP $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; //tls $mail->Host = "smtp.googlemail.com"; $mail->Port = 465; //you could use port 25, 587, 465 for googlemail $mail->Username = "yourlessenabledaccount@gmail.com"; $mail->Password = "yourpassword"; if(!$mail->send()){ $response['message'] = 'Email has been sent successfully'; } else{ $response['message'] = 'Oops! Something went wrong while trying to send your email.'; } echo json_encode($response); } }
Using gmail requires encryption "tls/ssl". Before you send via gmail, you need to allow less secure app to access your email account. You could make use of your gmail account or just create a new one. To do that, click here to turn it on.
That's basically it, you simply need to access your controller from your browser or extend it to your view.
i get this error "Unable to load the requested class: Phpmailer"
ReplyDeleteThis comment has been removed by the author.
Deletesame here... Unable to load the requested class: Phpmailer
Deletehi Unable to load the requested class: Phpmailer fixed or not?
Deletesame problem here anyone tell the answer
DeleteHello World !
DeleteGood Day !
Keep you services updated & reliable with my stuff
Huge stuff of Tools, E-boooks, Tutorials, Scripting, Viruses, Spying e.t.c
See Me On
I C Q :> 752822040
Tele-Gram :> @killhacks
Many other stuff like
SSN/DL
ID's
CC CVV
DUMPS
Combos/I.P's/Proxies
You can get from my collections :-)
No one TEACH you
No one GUIDE you
No one BOOST you
But I'm always here for you
Hit me up for you desired stuff
I C Q here :> 752822040
Tele-Gram here :> @killhacks
%Waiting for you guys%
I think the final part should be this instead
ReplyDeleteif(!$mail->send()){
$response['message'] = 'Oops! Something went wrong while trying to send your email.';
}
else{
$response['message'] = 'Email has been sent successfully';
}
// updated controller
ReplyDeleteCharSet = 'UTF-8';
$mail->SetFrom('info@yourdomain.com','Yourdomain');
//You could either add recepient name or just the email address.
$mail->AddAddress($email,"Recepient name");
$mail->AddAddress($email);
//Address to which recipient will reply
$mail->addReplyTo('reply@yourdomain.com","Reply");
$mail->addCC("cc@example.com");
$mail->addBCC("bcc@example.com");
//Add a file attachment
$mail->addAttachment("file.txt", "File.txt");
$mail->addAttachment("images/profile.png"); //Filename is optional
//You could send the body as an HTML or a plain text
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
//Send email via SMTP
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl"; //tls
$mail->Host = "mail.yourdomain.com";
$mail->Port = 465; //you could use port 25, 587, 465 for googlemail
$mail->Username = "reply@yourdomain.com";
$mail->Password = "your-password";
if($mail->send())
{
$response['message'] = 'Email has been sent successfully';
}
else
{
$response['message'] = 'Oops! Something went wrong while trying to send your email.';
}
echo json_encode($response);
}
}
//some part auto truncated
ReplyDelete<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
class Email extends CI_Controller {
function __construct()
{
parent::__construct();
require APPPATH.'libraries/phpmailer/src/Exception.php';
require APPPATH.'libraries/phpmailer/src/PHPMailer.php';
require APPPATH.'libraries/phpmailer/src/SMTP.php';
}
function send_email()
{
$response = false;
$mail = new PHPMailer();
$subject = 'Test subject';
$body = 'Hi there, <strong>Carl</strong> here.<br/> This is our email body.';
$email = 'yourid@gmail.com';
.....
Hi Clients!
ReplyDeleteWe have the fresh and valid USA ssn leads and dead fullz
99% connectivity with quality
*If you have any trust issue before any deal you may get few to test
*Every leads are well checked and available 24 hours
*Fully cooperate with clients
*Format of Fullz/leads/profiles
°First & last Name
°SSN
°DOB
°(DRIVING LICENSE NUMBER)
°ADDRESS
(ZIP CODE,STATE,CITY)
°PHONE NUMBER
°EMAIL ADDRESS
°REFERENCE DETAILS
°BANK ACCOUNT DETAILS
****Contact Me****
*ICQ :748957107
*Telegram :@James307
*Gmail :taimoorh944@gmail.com
lead cost $2 for each
Price can be negotiable if order in bulk
*Contact soon!
*Hope a long term deal
*Thank You
Hello all
ReplyDeleteam looking few years that some guys comes into the market
they called themselves hacker, carder or spammer they rip the
peoples with different ways and it’s a badly impact to real hacker
now situation is that peoples doesn’t believe that real hackers and carder scammer exists.
Anyone want to make deal with me any type am available but first
I‘ll show the proof that am real then make a deal like
Available Services
..Wire Bank Transfer all over the world
..Western Union Transfer all over the world
..Credit Cards (USA, UK, AUS, CAN, NZ)
..School Grade upgrade / remove Records
..Spamming Tool
..keyloggers / rats
..Social Media recovery
.. Teaching Hacking / spamming / carding (1/2 hours course)
discount for re-seller
Contact: 24/7
fixitrogers@gmail.com
TESTIMONY ON HOW I GOT MY LOAN FROM A GENUINE FINANCE COMPANY LAST WEEK. Email for immediate response: drbenjaminfinance@gmail.com
ReplyDeleteI am Mrs,Leores J Miguel by name, I live in United State Of America, who have been a scam victim to so many fake lenders online between November last year till July this year but i thank my creator so much that he has finally smiled on me by directing me to this new lender who put a smile on my face this year 2020 and he did not scam me and also by not deceiving or lying to me and my friends but however this lending firm is BENJAMIN LOAN INVESTMENTS FINANCE (drbenjaminfinance@gmail.com) gave me 2% loan which amount is $900,000.00 united states dollars after my agreement to their company terms and conditions and one significant thing i love about this loan company is that they are fast and unique. {Dr.Benjamin Scarlet Owen} can also help you with a legit loan offer. He Has also helped some other colleagues of mine. If you need a genuine loan without cost/stress he his the right loan lender to wipe away your financial problems and crisis today. BENJAMIN LOAN INVESTMENTS FINANCE holds all of the information about how to obtain money quickly and painlessly via Call/Text: +1(415)630-7138 Email: drbenjaminfinance@gmail.com
When it comes to financial crisis and loan then BENJAMIN LOAN INVESTMENTS FINANCE is the place to go please just tell him I Mrs. Leores Miguel direct you Good Luck....
Hello World !
ReplyDeleteGood Day !
Keep you services updated & reliable with my stuff
Huge stuff of Tools, E-boooks, Tutorials, Scripting, Viruses, Spying e.t.c
See Me On
I C Q :> 752822040
Tele-Gram :> @killhacks
Many other stuff like
SSN/DL
ID's
CC CVV
DUMPS
Combos/I.P's/Proxies
You can get from my collections :-)
No one TEACH you
No one GUIDE you
No one BOOST you
But I'm always here for you
Hit me up for you desired stuff
I C Q here :> 752822040
Tele-Gram here :> @killhacks
%Waiting for you guys%