Page 1 of 1

Sending an email from within a page

Posted: Thu May 15, 2008 2:22 pm
by jmcgin51
Sorry in advance if this is not the right place to post this, but since it relates to CMSMailer, I thought it belonged with questions about the core.

See Calguy's post about sending an email from within a page: http://forum.cmsmadesimple.org/index.ph ... 525.0.html

The code doesn't work for me.  Running CMSMS 1.2.4 with CMSMailer 1.73.12.

I paste the code from Calguy's first post into my page, and create my UDT with the UDT code specified in his post, but this is what I get when I view the page:

string(138) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: $cmsmailer->reset() (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(157) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: $cmsmailer->SetSubject('Test Message') (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(173) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: $cmsmailer->AddAddress('calguy1000@cmsmadesimple.org') (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(164) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: $cmsmailer->SetBody('This is a test message') (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(137) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: $cmsmailer->Send() (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"

What could be causing this?  Is it an issue with CMSMailer, or the way I'm implementing the code, or what?

Please move this post if it belongs somewhere else.

Re: Sending an email from within a page

Posted: Thu May 15, 2008 2:58 pm
by Nullig
Well, firstly, I don't think you should be sending emails to calguy's account in your UDT.

Secondly, can you post your {cmsmailer} UDT code, so we can see if it's correct.

Thirdly, have you configured/tested CMSMailer, to see if it works?

Nullig

Re: Sending an email from within a page

Posted: Thu May 15, 2008 3:05 pm
by jmcgin51
Thanks Nullig.  Yes, obviously I will change the email address, subject, body, etc.  I just copied the code from Calguy's post into my page to make sure it displayed the form.

Here is the {cmsmailer} UDT.  Again, it was copied and pasted directly from Calguy's post.  I don't see anything I need to customize.  Right?

--
global $gCms;

$smarty =& $gCms->GetSmarty();
$cmsmailer =& $gCms->modules['CMSMailer']['object'];

$smarty->assign_by_ref('cmsmailer',$cmsmailer);
--

Yes, CMSMailer is configured and works fine for SelfReg, etc.

Re: Sending an email from within a page

Posted: Thu May 15, 2008 3:08 pm
by Nullig
And what is the code you have in your page/template that calls the UDT?

Nullig

Re: Sending an email from within a page

Posted: Thu May 15, 2008 3:13 pm
by jmcgin51
Sorry - that would probably be helpful ;-)

--
{if isset($smarty.post.submit)}
{cmsmailer} {* udt *}
{$cmsmailer->reset()}
{$cmsmailer->SetSubject('Test Message')}
{$cmsmailer->AddAddress('calguy1000@cmsmadesimple.org')}
{$cmsmailer->SetBody('This is a test message')}
{$cmsmailer->Send()}
Message Sent
{else}



{/if}
--

Again, copied directly from the forum post.

Re: Sending an email from within a page

Posted: Sat May 17, 2008 4:06 am
by jmcgin51
Any ideas, Nullig or Calguy?