PATCH /v2/mailings/:id
Update a mailing
PUT /v2/mailings/:id
Update a mailing
live_help Notes
assignment
This action requires one of theses roles:
Advanced staff
, Advanced tutor
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
mailing | optional , nil allowed . Must be a Hash |
mailing[subject] |
optional
. Must be String
The subject of the mail |
mailing[content] |
optional
. Must be String
The content of the mail, supports Markdown. |
mailing[from] |
optional
. Must be String
The mail sender, with the |
mailing[to] |
optional
, nil allowed
. Must be an array of any type
An array of emails for the mail’s |
mailing[cc] |
optional
, nil allowed
. Must be an array of any type
An array of emails for the mail’s |
mailing[bcc] |
optional
, nil allowed
. Must be an array of any type
An array of emails for the mail’s |
mailing[title] |
optional
, nil allowed
. Must be String
The title of the mail. If none, set to the subject |
mailing[subtitle] |
optional
, nil allowed
. Must be String
The subtitle of the mail |
mailing[identifier] |
optional
, nil allowed
. Must be String
The identifier of the mail, used with meta |
mailing[meta] |
optional
, nil allowed
. Must be Hash
The meta of the mail |
at |
optional
. Must be DateTime
The time to send the mail. If none, send it now. |
Examples
PUT /v2/mailings/7
{
"mailing": {
"content": "Hi andre,\nYou just *won* the mego jackpot !\nCheck [this link](http://spam.prizepool-game-lottery.xxx/winner.php)",
"from": "superwin-ultimate-@prizepool-game-lottery.sexy",
"identifier": "an_unique_identifier",
"subject": "You are the super online contest winner !!!",
"subtitle": "And it's kinda awesome",
"title": "You won the big jackpot",
"to": [
"andre@42.fr"
]
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"mailing":{"content":"Hi andre,\nYou just *won* the mego jackpot !\nCheck [this link](http://spam.prizepool-game-lottery.xxx/winner.php)","from":"superwin-ultimate-@prizepool-game-lottery.sexy","identifier":"an_unique_identifier","subject":"You are the super online contest winner !!!","subtitle":"And it's kinda awesome","title":"You won the big jackpot","to":["andre@42.fr"]}}' "https://api.intra.42.fr/v2/mailings/7"
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token
params = {mailing: {content: "Hi andre,
You just *won* the mego jackpot !
Check [this link](http://spam.prizepool-game-lottery.xxx/winner.php)", from: "superwin-ultimate-@prizepool-game-lottery.sexy", identifier: "an_unique_identifier", subject: "You are the super online contest winner !!!", subtitle: "And it's kinda awesome", title: "You won the big jackpot", to: ["andre@42.fr"]}}
response = token.put("/v2/mailings/7", params: params)
response.status
# => 204
response.parsed
# =>