auSend
The auSend class is part of the auLib package. It provides functions for sending messages to people (via e-mail) or websites.
Usage
All functions in auSend are static, which means they can only be called in the form auSend::Function()
.
Constants
_AU_SEND_BITLY_URL
URL for shortening URLs with bit.ly. Affects Bitly. Cannot be set before including auSend.php.
_AU_SEND_BITLY_LOGIN
Login for the bit.ly account that will be used when shortening URLs. Affects Bitly. Must be set before calling Bitly().
_AU_SEND_BITLY_KEY
Key for the bit.ly account that will be used when shortening URLs. Find this value by logging in at http://bit.ly/ and going to settings — it is under the API Key heading. Affects Bitly. Must be set before calling Bitly().
_AU_SEND_TWEET_URL
URL for posting tweets. Affects Tweet. Cannot be set before including auSend.php.
_AU_SEND_TWITTER_OAUTH_CONSUMER_KEY
Affects Tweet. Must be set before calling Tweet().
_AU_SEND_TWITTER_OAUTH_CONSUMER_SECRET
Affects Tweet. Must be set before calling Tweet().
_AU_SEND_TWITTER_OAUTH_TOKEN
Affects Tweet. Must be set before calling Tweet().
_AU_SEND_TWITTER_OAUTH_TOKEN_SECRET
Affects Tweet. Must be set before calling Tweet().
Public Functions
Bitly
Bitly($url)
Shortens a URL using the bit.ly web service. To use a bit.ly account, make sure the constants _AU_SEND_BITLY_LOGIN and _AU_SEND_BITLY_KEY are set to the login and API key for the account.
- $url = URL to shorten.
- @return = Shortened URL.
Email($subject, $body, $from, $to, $fromname, $toname, $cc, $bcc, $reply)
Sends an e-mail using the PHP mail function.
- $subject = Subject line for the e-mail.
- $body = Message body of the e-mail.
- $from = Sender of the e-mail. May be formatted either name@example.com or Display Name <name@example.com>.
- $to = Recipient of the e-mail. May be formatted either name@example.com or Display Name <name@example.com>. Multiple recipients may be separated by commas.
- $fromname = Display name of the sender. Should only be used if sender is formatted name@example.com.
- $toname = Display name of the recipient. Should only be used for single-recipient messages with recipient formatted name@example.com.
- $cc = Carbon copy recipient(s). Each may be formatted name@example.com or Display Name <name@example.com>. Multiple carbon copy recipients may be separated by commas.
- $bcc = Blind carbon copy recipient(s). Each may be formatted name@example.com or Display Name <name@example.com>. Multiple blind carbon copy recipients may be separated by commas.
- $reply Whether the Reply-To header should be set. Use true to set sender as reply address or format a different address as either name@example.com or Display Name <name@example.com>.
- @return Whether an e-mail message was sent.
Tweet
Tweet($message)
Sends a message to Twitter to be posted as a tweet. The following constants must be defined correctly for the Twitter account the message should be posted to: _AU_SEND_TWITTER_OAUTH_CONSUMER_KEY, _AU_SEND_TWITTER_OAUTH_CONSUMER_SECRET, _AU_SEND_TWITTER_OAUTH_TOKEN, and _AU_SEND_TWITTER_OAUTH_TOKEN_SECRET.
- $message = Message to post to Twitter as a tweet.
- @return = Response from Twitter with code and text fields.