Reputation: 16
Can you tell me how to retrieve email config values (as set up in Config/email.php)? The documentation appears to tell me how to load or set values when creating the CakeEmail object, but I just want to display to the user default values like the "from" address BEFORE they override them or send the email.
Upvotes: 0
Views: 137
Reputation: 8540
You've got a couple of options. You can either get all the email config and extract the bits you need from that using CakeEmail::config()
or extract just the bit you need, for example the from email using CakeEmail::from()
:-
<?php
$Email = new CakeEmail('default');
// Get all the email config
$config = $Email->config();
debug($config['from']);
// Get just the 'from' email config
$from = $Email->from();
debug($from);
Upvotes: 1
Reputation: 16
OK - I think I have stumbled on the answer; CakeEmail has a (public) "from()" method which returns the (protected) "from" property - this is covered in the "API" documentation, but not in the "book" documentation.
Upvotes: 0