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?
SOLVED: How to use new cms_mailer-class in UDT?
SOLVED: How to use new cms_mailer-class in UDT?
Last edited by Freud on Thu Feb 18, 2016 3:14 pm, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: How to use new cms_mailer-class in UDT?
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.
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.
SOLVED: How to use new cms_mailer-class in UDT?
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!
It was that first line of code that I was looking for.
Changed my UDT, tested it and it works.
Thanks for your help!