mail codeigniter was sent,but not found in inbox - codeigniter

i was testing to send email by using codeigniter and i successfully send the email,but when i checked my inbox,i didn't find my email i send before.
here's controller:
$this->load->library('email');
$this->email->from('email#yahoo.com', 'my name');
$this->email->to('email#yahoo.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
success message:
Your message has been successfully sent using the following protocol: mail
From: "XXXXXXXXXXXXXX"
Return-Path:
Reply-To: "XXXXXXX#yahoo.com"
X-Sender: XXXXXXX#yahoo.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <XXXXXXX#yahoo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?Email_Test?=
Testing the email class.

You may check your Spam folder in your email account.
Sometimes gmail/yahoo set email as spam when the mail send from local server.

Try using the following config...
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'your host',
'smtp_port' => 465,
'smtp_user' => 'your email address',
'smtp_pass' => 'password',
'mailtype' => 'html',
'mailpath' => '/usr/sbin/sendmail',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE;
);
$this->load->library('email', $config);

Depending on your server, you should also check your mail server logs to see if the email actually made it off the box. Sometimes you might have success sending it, as the mail is passed to EXIM on your server, but the mail might die in a queue.
If this is a linux box, typically start looking in /var/log/exim4/ etc; (of course depends on your mail server setup).

Related

'email has been sent' massage is shown email is not receiving in CodeIgniter

i have use CodeIgniter 2.2.6
i am trying to sent email but i can't get error and not received email
<?php
class email_otp_demo extends CI_Controller
{
public function index()
{
$this->load->library('email');
$config = Array(
'protocol' => 'smpt',
'mailpath' => '/usr/sbin/sendmail,
//'mailpath' => 'www.google.com', also try
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 587,
//'smtp_port' => 456, also try
'smtp_user' => 'my.email#gmail.com',
'smtp_pass' => 'mypassword',
'smtp_timeout'=>50,
'mailtype' => 'text',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE,
'newline' =>'\r\n'
);
// glnlwboynexfjqxj
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->set_crlf("\r\n");
$this->email->from('my.email#gmail.com', 'Social media website');
$this->email->to('sender#yahoo.com');
//$this->email->to('sender#gmail.com'); also try this
// $this->email->cc('another#another-example.com');
// $this->email->bcc('them#their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
echo $this->email->send();
echo "<hr>";
echo $this->email->print_debugger();
}
}
?>
i have get following output but not received email
1
Your message has been successfully sent using the following protocol: mail
User-Agent: CodeIgniter
Date: Sun, 4 Dec 2022 16:53:27 +0530
From: "Social media website" <renish.batada#gmail.com>
Return-Path: <renish.batada#gmail.com>
Reply-To: "renish.batada#gmail.com" <renish.batada#gmail.com>
X-Sender: renish.batada#gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <638c832f6b8c0#gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
=?iso-8859-1?Q?Email_Test?=
Testing the email class.
i have also try to enable and disable to step verification
but not received email
i use app password and original password but not workworking

i cant send mail codeigniter

I can't send mail from codeigniter to yandex mail when i using this code:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.yandex.com',
'smtp_port' => 465,
'smtp_user' => 'blablabla#yandex.com',
'smtp_pass' => 'blablabla',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'newline' => "\r\n"
);
$this->load->library('email');
$this->email->initialize($config);
$msg = $this->messages($f2, $f3);
$this->email->to($f1);
$this->email->subject('Here is Subject');
$this->email->message($msg);
if($this->email->send()){
echo "Masuk!";
}else{
echo "Gagal!";
}
echo $this->email->print_debugger();
And the result always says:
Gagal!Cannot send mail with no "From" header.
Cannot send mail with no "From" header.
You simply need to add a From address to your email, by calling
$this->email->from('your#example.com', 'Your Name');
or
$this->email->from('your#example.com');
Depending on the sending and receiving provider, that might get you in trouble though if you try and send the email under another From address, than the one you authenticated against the SMTP server with - it might get classified as spam then (or even rejected by the SMTP server right away) - so in this case here you should use blablabla#yandex.com as From.
you have to set a name and email as a sender.
for example if you set different email and name for sender it shows in inbox mail (Gmail for example) as like below image

How do I send email to local system using xamp and windows7 in codeigniter?

I'm trying to run this code :
$this->load->library('email');
$this->email->from('anu1488#gmail.com', 'Anudeep');
$this->email->to('anu1488#gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
When I tried to send, I got this error:
A PHP Error was encountered
Severity: Warning
Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Filename: libraries/Email.php
Line Number: 1553
What caused this? How can I resolve it?
It sounds like you do not have an SMTP server (mail server) set up on your local machine to send out email. It sounds like the libraries/Email.php file is referencing a hostname/port where a valid mail server does not live.
**I guess you need to setup email configuration and port number in config/email .**
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.googlemail.com';
$config['smtp_port']='465';
$config['smtp_timeout']='30';
$config['smtp_user']='abhi.abc#gmail.com';
$config['smtp_pass']='password';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['mailtype'] = "html";
**if every thing is correct from your side then you can just change 'smtp_port' number and then check it definitely it will work`enter code here`.**
try this,its working for me....
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'user#gmail.com',
'smtp_pass' => 'user password',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('user#gmail.com', 'User');
$this->email->to(sample#gmail.com);
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
if ($this->email->send()) {
$data['error'] = "Your email was sent";
} else {
show_error($this->email->print_debugger());
}
then open your php.ini and go to extension=php_openssl.dll and un comment this line .
after that restart ur wamp server.

Having trouble testing php to send email verification in xampp

I have to write a log in, registration, and restricted members functionality for a site, i everything works but i cant test sending the verification email, but need too. see if it sends and test the verification link in the email.
i am running an Acer Aspire 5920,
Ubuntu 12.04,
Xampp 1.8.1,
Codeigniter 2.1.3
In answer to my own question i needed to pass infomation to configure xampp to send the email:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'gmail.login#googlemail.com',
'smtp_pass' => 'your_password',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('gmail.login#googlemail.com', 'Your Name');
$this->email->to('recipient#destination.tld');
$this->email->subject(' CodeIgniter Rocks Socks ');
$this->email->message('Hello World');
if (!$this->email->send()){
show_error($this->email->print_debugger());
}else{
echo 'Your e-mail has been sent!';
}

Sending mail with CodeIgniter using SMTP protocol not working

I have a problem in sending mails using CI. I used the "sendmail" protocol to send mail but it is being filtered as spam. I used the SMTP protocol to solve the problem, but it's not getting sent.
My code is as follows:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '*******#gmail.com',
'smtp_pass' => '********',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$message = "test mail";
$this->email->set_newline("\r\n");
$this->email->from('dsiddharth2#gmail.com', 'St. Maries');
$this->email->to("dsiddharth2#gmail.com");
$this->email->subject('Contact - St. Marians Belguam');
$this->email->message($message);
if($this->email->send())
{
echo "mail sent successfully";
}
else
{
show_error($this->email->print_debugger());
}
When I send the email using "smtp" protocol in CI, I get the following error:
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1673
and other list of errors...
I asked the server admin to enable the "openssl". It's been already taken care of and is enabled.
If you want to try it out, please visit this link and check for yourself.
If it's not working, check your php.ini file. Change this line
;extension=php_openssl.dll
to
extension=php_openssl.dll
It means remove the comment from the line in php.ini file.

Resources