SOLVED: How to use new cms_mailer-class in UDT?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
Freud
Forum Members
Forum Members
Posts: 53
Joined: Fri Jun 12, 2009 6:45 pm

SOLVED: How to use new cms_mailer-class in UDT?

Post by Freud »

In the CMSMS 1.* series I was used to use the CMSMailer-module to send mails in user defined tags.
I've read that in CMSMS 2.* the mail-API is pat of the core and that there is no need to install the CMSMailer-module anymore.
I have found the cms_mailer-class in the API-documentation, but I can't seem to get it to work in an UDT and I can't find any example-code for this.
Can anybody help me with that?
Last edited by Freud on Thu Feb 18, 2016 3:14 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How to use new cms_mailer-class in UDT?

Post by calguy1000 »

There are no examples, because it's really simple. You no longer need to get the instance of the CMSMailer module, just create a new cms_mailer object.

Code: Select all

$mailer = new \cms_mailer;
$mailer->SetSubject($subject);
$mailer->SetBody($body);
$mailer->AddAddress($email);
$mailer->Send();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Freud
Forum Members
Forum Members
Posts: 53
Joined: Fri Jun 12, 2009 6:45 pm

SOLVED: How to use new cms_mailer-class in UDT?

Post by Freud »

That's realy simple!
It was that first line of code that I was looking for.
Changed my UDT, tested it and it works.
Thanks for your help!
Post Reply

Return to “CMSMS Core”