Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Getting blank email with embeded images
#1

[eluser]Cgull[/eluser]
Hello,

I found this post: Inline images in emails

I tried it but I keep getting blank emails, testing on my local machine with gmail.

I am using ci 2.1.2

My email.php file:
Code:
$config["multipart"]="related";
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['crlf'] = "\n";
$config['protocol']    = 'smtp';
$config['smtp_host']    = 'ssl://smtp.gmail.com';
$config['smtp_port']    = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user']    = 'myemail';
$config['smtp_pass']    = 'pass';

My folders structure is:
mysite/appclication
mysite/public_html/assets/img

I'm not sure how to get an image that is in public_html/assets/img in a controller, so I moved the image to the controllers folder, any help here would be appriciated as well

My controller:
Code:
$this->load->library('email');
   $this->config->load('email', TRUE);
  
   //Sending email to the brewery
   $name = $this->data['dets']->firstname . ' ' . $this->data['dets']->surname;
   $this->email->from($fromEmail, $fromEmailName);
   $this->email->to($toEmail);

   $this->email->subject($subject);
   $this->email->message($this->load->view($msg, '', TRUE));
   $this->email->attach('think-local-logo.gif', 'inline');

   return ($this->email->send());

In my view:
Code:
<img src="&lt;?php echo 'cid:' . site_url('assets/img/thinklocal/think-local-logo.gif'); ?&gt;" />

Can someone please help?

UPDATE: Managed to solve this by using PHPMailer instead of CI email library.




Theme © iAndrew 2016 - Forum software by © MyBB