Smtp

Smtp configuration

edit config/config.ini

[ActionMailer]
  address  = mail.example.com
  port  = 25
  domain  = example.com
  user_name  = admin@example
  password  = user_password
  ttl  = false

Code

setting basic header

$this->Mail->to('"USER NAME" ');
$this->Mail->from('"USER NAME" ');
$this->Mail->subject("SUBJECT");

adding attachments

$this>Mail->attachment(DIR_PUBLIC . 'file.txt');
$this>Mail->attachment(DIR_PUBLIC . 'another_file.txt');

setting body

$body = $this->render_to_string('/notifier/registration');
$this->Mail->plain($body);
or
$this->Mail->html($body);
or
$this->Mail->body($body);

send an email

$this->Mail->send();

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>