6 * send email invitations to join social network
10 function invite_post(&$a) {
13 notice( t('Permission denied.') . EOL);
18 $recips = ((x($_POST,'recipients')) ? explode("\n",$_POST['recipients']) : array());
19 $message = ((x($_POST,'message')) ? notags(trim($_POST['message'])) : '');
23 foreach($recips as $recip) {
25 $recip = trim($recip);
27 if(! valid_email($recip)) {
28 notice( sprintf( t('%s : Not a valid email address.'), $recip) . EOL);
32 $res = mail($recip, sprintf( t('Please join my network on %s'), $a->config['sitename']),
34 "From: " . $a->user['email'] . "\n"
35 . 'Content-type: text/plain; charset=UTF-8' . "\n"
36 . 'Content-transfer-encoding: 8bit' );
42 notice( sprintf( t('%s : Message delivery failed.'), $recip) . EOL);
46 notice( sprintf( tt("%d message sent.", "%d messages sent.", $total) , $total) . EOL);
51 function invite_content(&$a) {
54 notice( t('Permission denied.') . EOL);
58 $tpl = get_markup_template('invite.tpl');
60 $o = replace_macros($tpl, array(
61 '$invite' => t('Send invitations'),
62 '$addr_text' => t('Enter email addresses, one per line:'),
63 '$msg_text' => t('Your message:'),
64 '$default_message' => sprintf(t('Please join my social network on %s'), $a->config['sitename']) . "\r\n" . "\r\n"
65 . t('To accept this invitation, please visit:') . "\r\n" . "\r\n" . $a->get_baseurl()
66 . "\r\n" . "\r\n" . t('Once you have registered, please connect with me via my profile page at:')
67 . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] ,
68 '$submit' => t('Submit')