Birthday Mail

11 years 9 months ago #121599 by djphil
Birthday Mail was created by djphil
Bonjour,

je cherche à envoyer un mail personnalisé automatiquement à un membre pour son anniversaire.
Est-ce que quelqu'un veut bien développer ce plugin pour moi gratuitement ?

( voir aussi )

Merci d'avance.
Cordialement, djphil

Translate:

Hello,

I try to send a personalized email automatically to one member for his birthday.
Is anyone willing to develop this plugin for me free?

( see too )

Thank you in advance.
Sincerely, djphil

Please Log in to join the conversation.

11 years 8 months ago #123214 by djphil
Replied by djphil on topic Re:Birthday Mail
No solutions ? :(

Please Log in to join the conversation.

11 years 8 months ago #123513 by djphil
Replied by djphil on topic Re:Birthday Mail
Hello,
Here may be the start of interesting track ...
(found on forum.joomla.org ).
kshipra wrote:

[code:1]<?xml version="1.0" encoding="utf-8"?>
<install version="1.5.2" type="plugin" group="system">
<name>System-Send Email</name>
<author>name</author>
<creationDate>December 2009</creationDate>
<copyright>Copyright (C) 2009 Holder. All rights reserved.</copyright>
<license>GNU General Public License</license>
<authorEmail>email</authorEmail>
<authorUrl>url</authorUrl>
<version>1.0.1</version>
<description>Provides email functionality</description>
<files>
<filename plugin="email">sendemail.php</filename>
</files>
<params>
</params>
</install>[/code:1]

[code:1]<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.plugin.plugin' );
//$mainframe->registerEvent( 'sendEmail', 'plgContentSendEmail' );
/**
* Example system plugin
*/
class plgSystemSendEmail extends JPlugin
{
/**
* Constructor
*
* For php4 compatibility we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/


/**
* Do something onAfterInitialise
*/

function plgSystemSendEmail(& $subject, $config) {
parent::__construct($subject, $config);
}

function onAfterInitialise()
{
global $mainframe;
$user = &JFactory::getUser();
$days_before = '7';
$days_after = '1';
$query= 'SELECT `id` AS `id`, `name` AS `name`, `cb_birthday` AS `birthday`,u.email as email FROM `#__users` b WHERE b.`cb_birthday` <> '' AND b.`cb_birthday` IS NOT NULL AND b.`cb_birthday` <> 0 AND b.block = 0';

$db->setQuery($query);
$rows = $db->loadAssocList();
if ($db->getErrorMsg())
{
JError::handleLog(JError::raiseWarning($db->getErrorNum(), $db->getErrorMsg()) , null);
return null;
}
$day=date(D);
list = array();

foreach ($rows as $row) {
$birthday = &JFactory::getDate($row);
$age = (int)round(($today->toUnix() - $birthday->toUnix()) / (365 * 24 * 60 * 60));
$birthday_details = getdate($birthday->toUnix());
$new_birthday = &JFactory::getDate(mktime(0, 0, 0, $birthday_details, $birthday_details, $birthday_details + $age));
$days_left = (int)round(($new_birthday->toUnix() - $today->toUnix()) / (24 * 60 *60));
if (($days_left <= $days_before) && ($days_left >= -$days_after)) {
$list[(200 + $days_left).'_'.$row['name']] = array('id' => $row, 'name' => $row, 'birthday' => $birthday, 'new_birthday' => $new_birthday, 'age' => $age, 'days_left' => $days_left);
$to.=$row.",";
}
//print_r($user);

if($day=='Sat')
{
echo $to;
$header="\r\n";
$from='';
$subject="Happy Birthday";
$body="Happy Birthday";
if($bcc!=""«»)
{
$header="Bcc: ".$bcc." ". "\r\n";
}
$header.='MIME-Version: 1.0' . "\r\n".'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $body, "From:".$from.$header);
}
// Perform some action
}
}
?>[/code:1]

:cheer:

Post edited by: djphil, at: 2010/02/03 15:19

Please Log in to join the conversation.

11 years 8 months ago #123916 by PCAnalyzer
Replied by PCAnalyzer on topic Re:Birthday Mail
Somebody tried it?
It seems good for my community site :)

Please Log in to join the conversation.

11 years 8 months ago #124500 by djphil
Replied by djphil on topic Re:Birthday Mail
I need your help please, thank you!

Please Log in to join the conversation.

11 years 6 months ago #128239 by djphil
Replied by djphil on topic Re:Birthday Mail
Bonsoir, un petit UP! afiin de ne pas tomber aux oubliettes ... :unsure:

Merci d'avance, cordialement
djphil

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.240 seconds