Email Helper¶
Available Functions¶
The following functions are available:
-
valid_mail
($email)¶ -
Parameters: - $email (string) – E-mail address
Returns: TRUE if a valid email is supplied, FALSE otherwise
Return type: bool
Checks if the input is a correctly formatted e-mail address. Note that is doesn’t actually prove that the address will be able recieve mail, but simply that it is a validly formed address.
Example:
if (valid_mail('email@somesite.com')) { echo 'email is valid'; } else { echo 'email is not valid'; }
Note
All that this function does is to use PHP’s native
filter_var()
:(bool) filter_var($email, FILTER_VALIDATE_EMAIL);
-
send_mail
($recipient, $message, $subject = NULL)¶ -
Parameters: - $recipient (string) – E-mail address
- $message (string) – Message body
- $subject (string) – Mail subject
Returns: TRUE if the mail was successfully sent, FALSE in case of an error
Return type: bool
Sends an email using PHP’s native mail() function.
Note
All that this function does is to use PHP’s native
mail
mail($recipient, $message, $subject);