You are here

function example_send_invite_email in Invite 7.2

Send an invitation email.

File

./invite.api.php, line 115
API documentation for Invite module.

Code

function example_send_invite_email() {

  // Either load an existing invite...
  if ($reg_code) {
    $invite = invite_load($reg_code);

    // Modify parameters if necessary.
    $invite->expiry = REQUEST_TIME + (60 * 60 * 24 + 7);
    $invite->data = array(
      'subject' => $subject,
      'message' => $message,
    );
  }
  else {
    $invite = invite_create();

    // Specify initial parameters.
    $invite->email = $email;
    $invite->data = array(
      'subject' => $subject,
      'message' => $message,
    );
  }

  // Send email to the invitee. If sending is successful, $invite is saved to the database.
  invite_send($invite);
}