API:Emailuser

Token
To send an e-mail, an e-mail token is required. This token is equal to the edit token and the same for all recipients, but changes at every login. An e-mail token can be obtained as follows:

Sending e-mail to users
You can send e-mail to users who have a confirmed e-mail address with action=emailuser.

Parameters

 * : User to send e-mail to
 * : The subject of the message
 * : The message
 * : The token obtained in the previous request. Take care to encode the  as
 * : If set, a copy of the e-mail will be sent to you

Examples
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=emailuser requires POST requests; GET requests will cause an error.

Possible errors
In addition to the usual stuff:


 * code: cantsend
 * info: You're not logged in or you don't have a confirmed e-mail address, so you can't send e-mail
 * code: blockedfrommail
 * info: You have been blocked from sending e-mail
 * code: usermaildisabled
 * info: User email has been disabled
 * code: notarget
 * info: You have not specified a valid target for this action
 * code: noemail
 * info: The user has not specified a valid e-mail address, or has chosen not to receive e-mail from other users

Checking emailable status
Before trying to send an email, it is recommended to check if the user is emailable first. To do this, you can execute a list query on the user (or several users at once). Here is an example using Ajax:

If you are testing from a client-side script, it is also possible to simply check for the existence of the t-emailuser list item: