+ $header = sprintf(_('Hello %s'),$name);
+ $header .= "\n\n";
+
+ /* add standard header and footer */
+ $subject = "$EmailName ";
+ if($gameid)
+ $game = DB_format_gameid($gameid);
+ else
+ $game = '';
+
+ switch($type)
+ {
+ case GAME_CANCELED:
+ $subject.=sprintf(_('Game %s canceled'),$game);
+ break;
+ case GAME_CANCELED_POVERTY:
+ $subject.=sprintf(_('Game %s canceled (poverty not resolved)'),$game);
+ break;
+ case GAME_CANCELED_TIMEOUT:
+ $subject.=sprintf(_('Game %s canceled (timed out)'),$game);
+ break;
+ case GAME_YOUR_TURN:
+ $subject.=sprintf(_('A card has been played in game %s'),$game);
+ break;
+ case GAME_READY:
+ $subject.=sprintf(_('Ready, set, go... (game %s)'),$game);
+ break;
+ case GAME_POVERTY:
+ $subject.=sprintf(_('Poverty (game %s)'),$game);
+ break;
+ case GAME_DPOVERTY:
+ $subject.=sprintf(_('Double poverty (game %s)'),$game);
+ break;
+ case GAME_OVER:
+ $subject.=sprintf(_('Game over (game %s)'),$game);
+ break;
+ case GAME_RECOVERY:
+ $subject.=_('Recovery');
+ break;
+ case GAME_REMINDER:
+ $subject.=sprintf(_("Reminder: game %s it's your turn"),$game);
+ break;
+ case GAME_NEW:
+ $subject.=sprintf(_('You are invited to a game of DoKo (game %s)'),$game);
+ break;
+ default:
+ $subject.=sprintf(_('Problem with email, contact admin (errorcode %d)'),$gameid);
+ }
+
+ /* standard goodbye */
+ $footer = "\n"._('Have a nice day')."\n "._('your E-Doko service department').
+ "\n\n".
+ "-- \n".
+ _('You can change your mail delivery mode in the preference menu.').
+ "\n".
+ _('web').': http://doko.nubati.net '.
+ _('help, bugs, etc.').": $WIKI";
+
+ if($send_now)
+ sendmail($To,$subject,$header.$message.$footer);
+ else
+ {
+ /* store email in database */
+ DB_digest_insert_email($To,$message,$type,$gameid);
+ }