5. Examples
curl http://127.0.0.1:80/v1/submission \
-H "Content-Type: application/json" \
-H "X-API-Key: badsecret" \
-d @- << EOF
{
"sender": {
"localpart": "bounces",
"domain": "example.com"
},
"recipients": [
{
"localpart": "john",
"domain": "example.net"
}
],
"message": {
"from": "Example <[email protected]>",
"subject": "Hello World",
"text": "Hello World",
"html": "<html><body><b>Hello World</b></body></html>",
"headers": {
"X-Custom-Header": "My custom header"
}
}
}
EOF
curl http://127.0.0.1:80/v1/submission \
-H "Content-Type: application/json" \
-H "X-API-Key: badsecret" \
-d @- << EOF
{
"sender": {
"localpart": "bounces",
"domain": "example.com"
},
"recipients": [
{
"localpart": "john",
"domain": "example.net",
"substitutions": {
"name": {
"first": "John",
"last": "Doe"
}
}
},
{
"localpart": "jane",
"domain": "example.net",
"substitutions": {
"name": {
"first": "Jane",
"last": "Doe"
}
}
}
],
"message": {
"from": "Example <[email protected]>",
"subject": "Hello {{ name.first }}",
"text": "Hello {{ name.first }}",
"html": "<html><body><b>Hello {{ name.first }} {{ name.last }}</b></body></html>"
}
}
EOF
curl http://127.0.0.1:80/v1/submission \
-H "Content-Type: application/json" \
-H "X-API-Key: badsecret" \
-d @- << EOF
{
"sender": {
"localpart": "bounces",
"domain": "example.com"
},
"recipients": [
{
"localpart": "john",
"domain": "example.net"
}
],
"message": {
"from": "Example <[email protected]>",
"subject": "Hello World",
"text": "Hello World",
"html": "<html><body><b>Hello World</b></body></html>",
"attachments": [{
"name": "test.zip",
"type": "application/zip",
"data": "UEsDBBQACAAIABhEeFQAAAAAAAAAAAAAAAAIACAAVGVzdC50eHRVVA0AB6AePGKgHjxioB48YnV4CwABBPUBAAAEFAAAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgACAAYRHhUAAAAAAAAAACBAQAAEwAgAF9fTUFDT1NYLy5fVGVzdC50eHRVVA0AB6AePGKgHjxiqx48YnV4CwABBPUBAAAEFAAAAGNgFWNnYGJg8E1MVvAPVohQgAKQGAMnEBsxMDD6A2kgn7GRgSjgGBISBGGBdDCCGOg6WaDi/AwM4sn5uXqJBQU5qXohqRUlrnnJ+SmZeekQ/UB5BgEGBimEmpzE4pLS4tSUlMSSVOWAYKg98kDCA2gcQl1uYnIORA5klBQDgyhCrrA0sSgxryQzL5WhtCRN18La0NjEyNDc0sJkjpxNEkjTlQncMhB3irRe6Ths5Jk8nf2X1LFsy1jiggAdFOobGFgYWZsZGScbpiYaWIN9mpJZYs0AAFBLBwj/uAAV1QAAAIEBAABQSwECFAMUAAgACAAYRHhUAAAAAAIAAAAAAAAACAAgAAAAAAAAAAAApIEAAAAAVGVzdC50eHRVVA0AB6AePGKgHjxioB48YnV4CwABBPUBAAAEFAAAAFBLAQIUAxQACAAIABhEeFT/uAAV1QAAAIEBAAATACAAAAAAAAAAAACkgVgAAABfX01BQ09TWC8uX1Rlc3QudHh0VVQNAAegHjxioB48YqsePGJ1eAsAAQT1AQAABBQAAABQSwUGAAAAAAIAAgC3AAAAjgEAAAAA"
}]
}
}
EOF
curl http://127.0.0.1:80/v1/submission \
-H "Content-Type: application/json" \
-H "X-API-Key: badsecret" \
-d @- << EOF
{
"sender": {
"localpart": "bounces",
"domain": "example.com"
},
"recipients": [
{
"localpart": "john",
"domain": "example.net"
}
],
"message": {
"from": "Example <[email protected]>",
"subject": "Hello World",
"html": "<html><body><img src=\"cid:80a3ddf7-2874-44b9-8e44-33ae575eb95b\" width=\"100\" height=\"100\"></body></html>",
"attachments": [
{
"type": "image/png",
"cid": "80a3ddf7-2874-44b9-8e44-33ae575eb95b",
"data": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAAXNSR0IArs4c6QAAAMJlWElmTU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAARAAAAcgEyAAIAAAAUAAAAhIdpAAQAAAABAAAAmAAAAAAAAABIAAAAAQAAAEgAAAABUGl4ZWxtYXRvciAzLjkuOAAAM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