Hello everybody
I have a problem when I send emails in HTML.
I only use the SMTP relay.
To send email, I use the CodeIgniter framework.
If I send text emails, I have no problem. However, if I send an HTML email, I get a blank email.
Here is my code:
$this->load->library('email');
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.sendgrid.net',
'smtp_port' => 25,
'smtp_user' => 'xxxxx',
'smtp_pass' => 'xxxxx',
);
$html = "My email body";
$this->email->initialize($config);
$this->email->from('my_email@my_email.com', 'My Name');
$this->email->to('my_email@my_email.com');
$this->email->subject('Email Subject');
$this->email->message($html);
$this->email->send();
Thanks
Pierre
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
you need to tell the email object/class that its a html email,
$this->email->set_mailtype('html');
you will probably have to do something else as well, I've never used CI properly but found that out just by looking at the CI_Email class in
system/libraries/Email.php
the mailtype defaults to text. id search the CI docs for a html email example or tutorial! -
-
What is your Sendgrid username; I would like to look into your account to make sure there isn't anything in particular conflicting.
Thanks for your time and patience!
Brad S.
Support Engineer
Sendgrid, Inc. -
-
-
-
Ok,
After checking on your account, I saw that the 'Email Template' app was showing active on your account with a 'NULL' value which would cause the blank HTML e-mail you were seeing.
Please let us know if you experience any further problems; I corrected your profile on our backend.
Thanks for your time and patience. -
Loading Profile...





