kenold
kenold

Reputation: 318

Send email with CakePHP

I setup an email verification after a user has signed up, but when user receives email, it just says "info" in the FROM column in GMAIL. Is there a way I can change it to say something else like "Example.com" or " Email Verification"? I just want the user to see whom the email is from before opening it.

Here's how it's defined in config/constants.php - using CakePHP

if(!defined('EMAIL_FROM')) {

define('EMAIL_FROM', '[email protected]');

}

Please help.

Thanks

Upvotes: 0

Views: 270

Answers (3)

Rahul vats
Rahul vats

Reputation: 88

I think this help you

$this->Email->from = Configure::read('FROM_EMAIL');

Upvotes: 0

codea
codea

Reputation: 1252

I think adding it in front of the email adress would work :

if(!defined('EMAIL_FROM')) {    
  define('EMAIL_FROM', 'Email Verification <[email protected]>');    
}  

Upvotes: 0

Alex
Alex

Reputation: 1028

To define the from field you need to set it after initiating the CakeEmail object as shown in the documentation http://book.cakephp.org/2.0/en/core-utility-libraries/email.html

$email = new CakeEmail();
$email->from(array('[email protected]' => 'My Site'));
$email->to('[email protected]');
$email->subject('About');
$email->send('My message');

Upvotes: 1

Related Questions