I try to send an email with codeigniter library. Simple plain email working perfect but as soon as I put any URL like www.abc.com, codeigniter gives message that email sent but I never received. I change the mailtype to HTML with no luck.
Any ideas please.
$this->load->library('email');
$config['mailtype'] = "html";
$config['charset'] = "utf-8";
$config['priority'] = "1";
$this->email->initialize($config);
$this->email->from("myemail#gmail.com", 'TS');
$this->email->to("myemail#gmail.com");
$this->email->subject('Test Email');
$txt_site_name = "www.google.com";
$this->email->message("This is test email with link --> ".$txt_site_name);
if($this->email->send())
{
echo "The email has been sent";
}else{
echo "Could not send the email";
show_error($this->email->print_debugger());
}
Related
My controller is
public function basic_email() {
$data = array('name'=>"Virat Gandhi",'roll'=>"123");
Mail::send(['text'=>'mail'], $data, function($message) {
$message->to('xyz#gmail.com', 'Basil Baby')->subject
('Laravel Basic Testing Mail');
$message->from('abc#yahoo.com','Virat Gandhi');
});
echo "Basic Email Sent. Check your inbox.";
}
My blade is
Hi, {{ $name }}
your roll number is {{$roll}}
please click on the link to verify your account
Mail is being received. but the mail body is displaying html content as such. How to make verify you account a html link in mail body
Change your key text to html in your send function.
text key send data as a plain text
Mail::send( ['html' => 'mail']...
Also change {{}} to {!! !!}
Reference:
Laravel -> Mail
If you are trying to verify registered users, I would suggest you to use Laravel's build-in verification system.
You can follow the link:
Laravel email verification
Hi everyone for now I've been working on a summernote textarea but when I send my email message to the gmail address it turn out to be something like this with html and not as text when you open your inbox:
& lt;p&g t ;test</p>
This is my contoller code:
$this->load->library('email'); // load email library
$this->email->set_newline ("\r\n");
$this->email->from($this->session->userdata('user_email'),$this->session- >userdata('user_firstname').' '.$this->session->userdata('user_lastname'));
$this->email->to(set_value('message_email_to'));
$this->email->subject(set_value('subject'));
$this->email->message(set_value('message'));
if($this->email->send())
{
$this->Compose_model->insert($data);
$this->session->set_flashdata('message', 'Create Record Success');
redirect(BASE_URL.'tenant/compose');
}
else
{
show_error($this->email->print_debugger());
}
Try this
$this->load->library('email');
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";
$this->email->initialize($config);
put <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> on top of your message
Codeigniter "bcc" doesn't work, But the same code with "to" works just fine! Any suggestions why this happens and how to fix it?
Here's my code:
$email = "myEmail#myWebsite.com";
$subject = "my subject";
$message = "my message";
$this->email->set_mailtype("html"); // In my actual code this is needed
$this->email->from('myWebsiteEmail#myWebsite.com', 'Info');
// $this->email->to($email); // It works with this code
$this->email->bcc($email); // It doesn't work with this code
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
Any suggestions would be appreciated!
You have to have a to to be able to bcc
Try adding an email to the to as well as a bcc and it should work.
You may need to enable bcc_batch_mode in email config.
By default is value is FALSE.
It doesn't need a $this->email->to() all you need to do is set $config['bcc_batch_mode'] = TRUE; and then add the emails like $CI->email->bcc( $bccEmailArray );. The bcc method does not work like the cc method.
var onSuccess=function(data)
{
alert(data);
obj=JSON.parse(data);
var response=obj.response;
}
the above is my javascript file and next is the how i am sending the response
$hash=$this->db->query($query);
if ($hash->num_rows() > 0)
$valid['response']= 0;
else
$valid['response']= 1;
return($valid_user);
the alert box is showing "disallowed key characters" and even i had checked config file in codeigniter .... everything is correct as mentioned everywhere
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
I am trying to find an equivalent way to debug an email in Zend like I can in cakePHP. I want to see my test output before I send an email out for testing. I could just send the email to myself, and work bugs out that way, but I find that tedious.
//zend mail
$mail = new Zend_Mail();
$mail->setBodyHTML($content);
$mail->setBodyText($content);
$mail->setFrom('noreply#joe.com', 'Security Notification');
$mail->addTo('joeschmo#joe.com');
$mail->setSubject('(Security Notify) New Security Request');
//$mail->send();
//Equivalent to this from cakePHP
$this->Email->delivery = 'debug';
$this->Email->send('test message');
debug($this->Session->read('Message.email'));
die();
something like:
die($mail->getBodyHtml());
or
die(print_r($mail));
For your content in HTML, you can simply write:
echo $content; exit();
And for your content in plain text write:
echo '<pre>' . $content . '</pre>'; exit();