[solved] Forwarding news module posts to an email address
[solved] Forwarding news module posts to an email address
Is it possible to get the news module to automically forward a new post to an email address, possibly in html format?
Last edited by swarfega on Mon Aug 20, 2012 6:46 pm, edited 1 time in total.
-
- Power Poster
- Posts: 1049
- Joined: Wed Mar 19, 2008 4:54 pm
Re: Forwarding news module posts to an email address
(1) use this UDT and call it e.g. sending news
(2) Call this UDT when adding news with the Event manager
Code: Select all
$gCms = cmsms(); //global $gCms;
$editedby = $gCms->variables['username'];
$bodytext = 'start of the text.<br /><br>On ' . date('l j F Y', $params['start_time']) . ' a new message was posted on www.yourwebsite.com.<br><br><hr>
<h2> ' . $params['title'] . '</h2>
<br />' . $params['summary'] . '<br /><br />
'. $params['content'].'<br clear="right"><br>';
$cmsmailer =& cms_utils::get_module('CMSMailer');
$cmsmailer->SetFrom('sending emailaddress');
$cmsmailer->SetFromName('name sending emailaddress');
$cmsmailer->AddAddress('destination emailaddress', $name='name destination emailaddress');
$cmsmailer->SetBody($bodytext);
$cmsmailer->IsHTML(true);
$cmsmailer->SetSubject('titel of email ');
$cmsmailer->Send();
Re: Forwarding news module posts to an email address
Thank you, will try this out.
Re: Forwarding news module posts to an email address
Me too 
Greetings,
Manuel

Greetings,
Manuel
Do you like your open source cms? Buy from the CMSMS partners || Donate
Re: Forwarding news module posts to an email address
I can confirm this script works. Thanks for the response.
(sorry for the long delay, but I had problems getting this script added to the udt as the hosters security kept bouncing it.)
(sorry for the long delay, but I had problems getting this script added to the udt as the hosters security kept bouncing it.)
Re: [solved] Forwarding news module posts to an email addres
Just a quick question, am I able to include attachments at all? Currently I use the attachments module to attach files like pdfs to a news article after the news article has been submitted.