2013-12-26 13:34:48 +01:00
< ? php
2014-12-07 20:42:54 +01:00
function engelsystem_email_to_user ( $recipient_user , $title , $message , $not_if_its_me = false ) {
global $user ;
2013-12-26 13:34:48 +01:00
2016-09-29 09:49:25 +02:00
if ( $not_if_its_me && $user [ 'UID' ] == $recipient_user [ 'UID' ]) {
2014-12-07 20:42:54 +01:00
return true ;
2016-09-29 09:49:25 +02:00
}
2014-12-07 20:42:54 +01:00
gettext_locale ( $recipient_user [ 'Sprache' ]);
$message = sprintf ( _ ( " Hi %s, " ), $recipient_user [ 'Nick' ]) . " \n \n " . _ ( " here is a message for you from the engelsystem: " ) . " \n \n " . $message . " \n \n " . _ ( " This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem. " );
2013-12-26 13:34:48 +01:00
gettext_locale ();
2014-12-07 20:42:54 +01:00
return engelsystem_email ( $recipient_user [ 'email' ], $title , $message );
2013-12-26 13:34:48 +01:00
}
function engelsystem_email ( $address , $title , $message ) {
2016-11-15 22:08:41 +01:00
$result = mail ( $address , $title , $message , " Content-Type: text/plain; charset=UTF-8 \r \n From: Engelsystem <noreply@engelsystem.de> " );
if ( $result === false ) {
engelsystem_error ( 'Unable to send email.' );
}
2013-12-26 13:34:48 +01:00
}
2014-12-06 18:10:27 +01:00
?>