? No Code Attached Yet
avatar brianteeman
brianteeman
27 Mar 2023

If you are sending an email from a component etc using Factory::getMailer then you can set the mailfrom and from name quite easily.

But as far as I can see if you are using MailTemplate then there is no way to set the mailfrom email or name and it will only use the settings from global configuration.

Is that correct?

avatar brianteeman brianteeman - open - 27 Mar 2023
avatar joomla-cms-bot joomla-cms-bot - change - 27 Mar 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Mar 2023
avatar Fedik
Fedik - comment - 27 Mar 2023

Yes, you are right. This is missing feature in MailTemplate.

avatar brianteeman
brianteeman - comment - 27 Mar 2023

I had a go at adding this missing functionality but failed :(

avatar wojtekxtx
wojtekxtx - comment - 28 Mar 2023

@brianteeman what was the reason of you failing to add it?

avatar Fedik Fedik - change - 28 Mar 2023
Labels Added: ?
avatar Fedik Fedik - labeled - 28 Mar 2023
avatar nyni123
nyni123 - comment - 10 Apr 2023

Hi @brianteeman ,

Sorry to hear that you were not able to add the missing functionality to MailTemplate. Can you tell me a bit more about what you tried and what issues you encountered? Maybe I can offer some suggestions or insights to help you troubleshoot the problem.

In the meantime, I have a possible solution that might work for you. You could try using the setSender method of the JMail class to set the mailfrom email and name.
Here's an example:

$mailer = JFactory::getMailer();
$mailer->setSender('example@example.com', 'Example Name');

This should override the global configuration settings for mailfrom email and name and use the values you set instead.

Let me know if this works for you or if you have any further questions.

avatar brianteeman
brianteeman - comment - 10 Apr 2023

Interesting
image

avatar wojtekxtx
wojtekxtx - comment - 10 Apr 2023

@brianteeman hehe :)

avatar peteruoi
peteruoi - comment - 10 Apr 2023

If he was in Dan mode it would be hard to tell apart if it's gpt or someone just toxic that likes to help in joomla

Add a Comment

Login with GitHub to post a comment