Hi there. I have a situation where I need my application to use a different mail server for a specific function. I need to be able to bypass the mail settings I have in the main.php configs. I’ve tried several different ways to do this but I can’t seem to get anything to work.
Basically in my main.php I have the mail config for ext.yii-mail.YiiMail. For all of the functions of the website, I need it to use those settings.
But for one specific function, I need to specify a completely different SMTP server along with a username and password.
We use the params file with different addresses for incoming mail, Yii::app()->params[‘emailAdmin’], …[emailSupport’], etc. Instead of bypassing, you would have two set ups in params and call the appropriate one when needed. Make sense?
Sorry for the delay in my reply, but since I’m a new user it only allows me 2 posts per day
If I set the config up this way, how would I invoke the mail object? Right now I do it by
$message = new YiiMailMessage;
Both of those component configs are using the same class, so I’m not sure how I would call it.
I found an alternative where I can use createComponent inside my function, but I’d much rather have it in the config and call it separately like you suggested.