6 function notify_setup($type,$params) {
9 $banner = t('Friendica Notification');
10 $product = FRIENDICA_PLATFORM;
12 $thanks = t('Thank You,');
13 $sitename = get_config('config','sitename');
14 $site_admin = sprintf( t('%s Administrator'), $sitename);
16 $sender_name = t('Administrator');
17 $sender_email = t('noreply') . '@' . $a->get_hostname(),
19 if($type === NOTIFICATION_MAIL) {
20 $new_email = sprintf( t('%s sent you a new private message at %s.'),$params['from'],$sitename);
21 $email_visit = t('Please visit %s to view and/or reply to your private messages.');
22 $email_tlink = sprintf( $email_visit, $siteurl . '/message' );
23 $email_hlink = sprintf( $email_visit, '<a href="' . $siteurl . '/message">' . $sitename . '</a>');
29 require_once('include/email.php');
33 * Send a multipart/alternative message with Text and HTML versions
35 * @param fromName name of the sender
36 * @param fromEmail email fo the sender
37 * @param replyTo replyTo address to direct responses
38 * @param toEmail destination email address
39 * @param messageSubject subject of the message
40 * @param htmlVersion html version of the message
41 * @param textVersion text only version of the message
43 static public function send($params) {
44 $fromName = email_header_encode($params['fromName'],'UTF-8');
45 $messageSubject = email_header_encode(params['messageSubject'],'UTF-8');
48 // generate a mime boundary
49 $mimeBoundary =rand(0,9)."-"
50 .rand(10000000000,9999999999)."-"
51 .rand(10000000000,9999999999)."=:"
54 // generate a multipart/alternative message header
56 "From: {$params['fromName']} <{$params['fromEmail']}>\n" .
57 "Reply-To: {$params['replyTo']}\n" .
58 "MIME-Version: 1.0\n" .
59 "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
61 // assemble the final multipart message body with the text and html types included
62 $textBody = chunk_split(base64_encode($params['textVersion']));
63 $htmlBody = chunk_split(base64_encode($params['htmlVersion']));
64 $multipartMessageBody =
65 "--" . $mimeBoundary . "\n" . // plain text section
66 "Content-Type: text/plain; charset=UTF-8\n" .
67 "Content-Transfer-Encoding: base64\n\n" .
69 "--" . $mimeBoundary . "\n" . // text/html section
70 "Content-Type: text/html; charset=UTF-8\n" .
71 "Content-Transfer-Encoding: base64\n\n" .
73 "--" . $mimeBoundary . "--\n"; // message ending
77 $toEmail, // send to address
78 $messageSubject, // subject
79 $multipartMessageBody, // message body
80 $messageHeader // message headers
82 logger("sendTextHtmlEmail: returns " . $res, LOGGER_DEBUG);