[SOLVED] Use CMSMailer in a UDT

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
Gust

[SOLVED] Use CMSMailer in a UDT

Post by Gust »

Hello,

I want to use CMSMailer in an UDT to send an e-mail. I've configured CMSMailer in the admin panel and received the test e-mail.


However, I've tested a quickly put-together UDT to test the use of CMSMailer, but I don't received the mail.

I am using this code:

Code: Select all

global $gCms;

//use CMSMailer module to send mail
$cmsmailer =& $gCms->modules['CMSMailer']['object']; 
$cmsmailer->AddAddress('my@email.com',$name='My Name'); 
$cmsmailer->SetPriority(1);
$cmsmailer->SetFrom('sender@email.com');
$cmsmailer->SetFromName('Sender Name');
$cmsmailer->SetBody('This is the body text'); 
$cmsmailer->IsHTML(true); 
$cmsmailer->SetSubject('This is the subject'); 
$cmsmailer->Send();
What am I doing wrong?
Last edited by Gust on Thu Apr 09, 2009 4:44 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Use CMSMailer in a UDT

Post by Dr.CSS »

What is this used for, kind of helps if you can give more info on what you are trying to achieve, as it may be something that is already being done like a contact form can be done ez using form builder, etc...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Use CMSMailer in a UDT

Post by calguy1000 »

there's an error in your UDT.
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.
Gust

Re: Use CMSMailer in a UDT

Post by Gust »

mark wrote: What is this used for, kind of helps if you can give more info on what you are trying to achieve, as it may be something that is already being done like a contact form can be done ez using form builder, etc...
I am using it to send the result of the form to an helpdesk, which transfers it into a support ticket.

The code I've posted above is just a test to see how sending mail with CMSMailer with a UDT works...

CMSMailer is set to send mail over SMTP...

It can't be done with Form Builder or something, because I need a specific  form and need to set a priority for the mail that will be send (so the ticket also automaticly get a priority)...
Last edited by Gust on Wed Mar 25, 2009 6:07 pm, edited 1 time in total.
Gust

Re: Use CMSMailer in a UDT

Post by Gust »

calguy1000 wrote: there's an error in your UDT.
Can you elaborate on this?

Which error did I make?
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Use CMSMailer in a UDT

Post by Nullig »

I think this:

$cmsmailer->AddAddress('my@email.com',$name='My Name');

should be:

$cmsmailer->AddAddress('my@email.com','My Name');

Nullig
Gust

Re: Use CMSMailer in a UDT

Post by Gust »

Appearantly it was an authentification problem.

When I call the function of CMSMailer in the UDT, it didn't take the login details for the SMTP-server that I set up in CMSMailer configuration.

So I call this explicit in the UDT and my problem was solved!

Grtz,
Gust
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Use CMSMailer in a UDT

Post by Dr.CSS »

Locked

Return to “Modules/Add-Ons”