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']),
33 $message, "From: " . $a->user['email']);
38 notice( sprintf( t('%s : Message delivery failed.'), $recip) . EOL);
42 notice( sprintf( tt("%d message sent.", "%d messages sent.", $total) , $total) . EOL);
47 function invite_content(&$a) {
50 notice( t('Permission denied.') . EOL);
54 $tpl = load_view_file('view/invite.tpl');
56 $o = replace_macros($tpl, array(
57 '$invite' => t('Send invitations'),
58 '$addr_text' => t('Enter email addresses, one per line:'),
59 '$msg_text' => t('Your message:'),
60 '$default_message' => sprintf(t('Please join my social network on %s'), $a->config['sitename']) . "\r\n" . "\r\n"
61 . t('To accept this invitation, please visit:') . "\r\n" . "\r\n" . $a->get_baseurl()
62 . "\r\n" . "\r\n" . t('Once you have registered, please connect with me via my profile page at:')
63 . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] ,
64 '$submit' => t('Submit')