×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Using with a Custom Component

Using with a Custom Component 11 years 5 months ago #21481

  • Walter White
  • Walter White's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 13
Hi Daniel - I am developing a custom Joomla component for a client, and would like to send transactional emails (subscriptions to event updates, etc.) with this custom component. With the CMandrill component installed and the plug-in enabled, the component will not send emails. That could be due to the email configuration (SMTP) used for Mandrill.

I contacted the folks at mandrill.com, and they suggested I seek your help. I created a template in the CMandrill component, and linked it to the component, yet no emails send. If I create a from in RSForm!Pro, it will send an email through the Mandrill API.

Any ideas on how I can enable my component to send these emails successfully?
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, Stefan Basting

Using with a Custom Component 11 years 5 months ago #21482

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
If the plugin is enabled we don't use the SMTP configuration, but the mandrill API.

Do you use:
$mail = JFactory::getMailer();
$mail->send(....);

or how do you exactly send your mails?

Also try to have the plugin ordered first in the plugin list (first for system tasks).

That is what pops up into my head right now.

Regards,
Daniel
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, Stefan Basting

Using with a Custom Component 11 years 5 months ago #21487

  • Walter White
  • Walter White's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 13

Daniel Dimitrov wrote: If the plugin is enabled we don't use the SMTP configuration, but the mandrill API.

Do you use:

$mail = JFactory::getMailer();
$mail->send(....);

or how do you exactly send your mails?

Also try to have the plugin ordered first in the plugin list (first for system tasks).

That is what pops up into my head right now.

Regards,
Daniel


Thank you for the prompt reply.
$mail = JFactory::getMailer();
$mail->send(....);

is how the emails are being sent, and the plug-in is ordered first.

Just for the heck of it, I disabled the Mandrill plug-in, and the emails being sent are still using Mandrill (confirmed via headers). The Mail Settings in Joomla are set to send using SMTP, and the Mandrill account info is in there.
The following user(s) said Thank You: ewhitewhite, ranlaveresteph

Using with a Custom Component 11 years 5 months ago #21488

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
When do you send the mails? It's not in a CLI script or something like this or?
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, Stefan Basting

Using with a Custom Component 11 years 5 months ago #21489

  • Walter White
  • Walter White's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 13
Not using CLI script to send emails.
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, Stefan Basting

Using with a Custom Component 11 years 5 months ago #21490

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
The onafterrelease function of the plugin looks like this:
public function onAfterInitialise()
	{
		$params = JComponentHelper::getParams('com_cmandrill');
		$appl = JFactory::getApplication();
 
		$this->loadLanguage('plg_system_mandrill.sys');
 
		$key = $params->get('apiKey');
 
		if (strlen($key)) {
 
			$path = JPATH_ROOT . '/plugins/system/mandrill/mailer/mail.php';
 
			JLoader::register('JMail', $path);
			JLoader::load('JMail');
 
		} else {
			$appl->enqueueMessage(JText::sprintf('PLG_SYSTEM_MANDRILL_NO_API_KEY_SPECIFIED', JRoute::_('index.php?option=com_cmandrill')), 'warning');
			return false;
		}
	}

So if you have provided an api key in the component, then the plugin will override the JMail class. make a die in the if statement and see if it goes that far?
The following user(s) said Thank You: ewhitewhite

Using with a Custom Component 11 years 5 months ago #21491

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Also check the joomla logs. If for some reason we were unable to send the mail through the mandril api, we send it using the standard joomla config.

Have a look in the logs folder for a file related to mandrill and check it out.
The following user(s) said Thank You: ewhitewhite

Using with a Custom Component 11 years 5 months ago #21492

  • Walter White
  • Walter White's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 13
Even if the plug-in is disabled?

prntscr.com/1cdc6n
The following user(s) said Thank You: ewhitewhite

Using with a Custom Component 11 years 5 months ago #21493

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Well, there you have it man! The plugin should be enabled!
The following user(s) said Thank You: ewhitewhite

Using with a Custom Component 11 years 5 months ago #21496

  • Walter White
  • Walter White's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 13
lol

What I am asking is do you want me to try adding the 'die' test even though I have the plug-in disabled? It is only sending emails through Mandrill if the plug-in is disabled. If I enable the plug-in, it stops sending emails from my component.
The following user(s) said Thank You: ewhitewhite, Stefan Basting

Using with a Custom Component 11 years 5 months ago #21508

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Ah ok.
If a plugin is turned off, then the plugin doesn't get called by joomla. So if you leave it turn off and you do any die there you won't ever achieve anything.

The plugin needs to be on.
Also when do you send the mails. the plugin is executed onAFterInitialise -> if you send your mails before that, then it won't be able to do anything.
The following user(s) said Thank You: ewhitewhite, Stefan Basting
  • Page:
  • 1
Time to create page: 0.113 seconds