I have 4 templates but one returns error: "reject_reason": "invalid-sender".
I didn't find this error. in Docs.
I have 4 templates in my account and current template has following structure:
Template Slug: contact-home
From Address : info#somecomp.com
From Name: SOME_COMP
++ template as HTML.
This is a request I send from API Logs:
Full Request
{
"template_name": "contact-home",
"template_content": [
{
"name": "example name",
"content": "example content"
}
],
"message": {
"dest_mail": "mymail#gmail.com",
"merge": "true",
"to": [
{
"email": "mymail#gmail.com"
}
],
"merge_vars": [
{
"rcpt": "mymail#gmail.com",
"vars": [
{
"name": "FNAME",
"content": "name"
}
]
}
]
},
"key": "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Full response
[
{
"email": "abc#gmail.com",
"status": "rejected",
"_id": "a305475c544a4f12a52f5a2b205c2505",
"reject_reason": "invalid-sender"
}
]
I don't think its PHP problem because 3 other templates have the same structure and I use one PHP method.
Thank you,
I think its Mandrill issue.
The fix is:
open template
remove sender mail
press Publish
set the same mail
press Publish
Now its work.
If you need additional info let me know
Thanks
Related
So, basically I need a way to send the current URL link to A Discord webhook.
So for example, the URL would be https://www.example.com and I need that link to send to my Discord webhook.
Is there any way someone could help me with this? If this is not possible, are there any alternative methods?
I would recommend you first reading this—it explains in detail how to format the payload so that it renders as a message in Discord properly, you can even use markdown!
Second, I'm not sure what language you want to code this in, but here's a simple example using Python and httpx
The idea to take away here is
Pick a client library
Study the Discord webhook message format
Create a client for HTTP
Set the logic to send the payload to the webhook you want
Create and send the payload with the formatted webhook message in a POST request
data = {
"username": "Webhook",
"avatar_url": "https://i.imgur.com/4M34hi2.png",
"content": "Text message. Up to 2000 characters.",
"embeds": [
{
"author": {
"name": "Birdie♫",
"url": "https://www.reddit.com/r/cats/",
"icon_url": "https://i.imgur.com/R66g1Pe.jpg"
},
"title": "Title",
"url": "https://google.com/",
"description": "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`",
"color": 15258703,
"fields": [
{
"name": "Text",
"value": "More text",
"inline": true
},
{
"name": "Even more text",
"value": "Yup",
"inline": true
},
{
"name": "Use `\"inline\": true` parameter, if you want to display fields in the same line.",
"value": "okay..."
},
{
"name": "Thanks!",
"value": "You're welcome :wink:"
}
],
"thumbnail": {
"url": "https://upload.wikimedia.org/wikipedia/commons/3/38/4-Nature-Wallpapers-2014-1_ukaavUI.jpg"
},
"image": {
"url": "https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg"
},
"footer": {
"text": "Woah! So cool! :smirk:",
"icon_url": "https://i.imgur.com/fKL31aD.jpg"
}
}
]
}
import httpx # pip install httpx, or poetry add httpx
with httpx.Client() as client:
request = client.post("https://www.discordwebhook.com", data=data) # needs to be a POST
print(request.status_code)
I am trying send email through Microsoft graph api. I created a message object like the following.
{"message":{"subject":"hellowolrd","body":{"contentType":"text","content":"wow"}},"toRecipients":{"emailAddress":{"address":"example#yahoo.com"}}}
But gets 400 error with invalid recipient. Can anybody help me why I am getting this error.
It seems you have a syntax issue in your JSON request.Look closely after content you have an extra closing } which means you are not posting 'toRecipients' in the message.
{"message":{"subject":"hellowolrd","body":{"contentType":"text","content":"wow"}},"toRecipients":{"emailAddress":{"address":"example#yahoo.com"}}}
Instead try below JSON to make it work -
{
"message": {
"subject": "hellowolrd",
"body": {
"contentType": "text",
"content": "wow"
},
"toRecipients": [
{
"emailAddress": {
"address": "example#yahoo.com"
}
}
]
}
}
Thanks!
The invalid recipient was caused by a different json structure. I had to exactly match the following structure that was provided in one of their example.
$mailArgs ='
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "Lunch Invited"
},
"toRecipients": [
{
"emailAddress": {
"address": "example#example.com"
}
}
]
}
}';
So I created a JSON array to match exactly the same structure and it worked!
i'm trying to make a post on facebook using api with using child_attachments param, so i can pass multiple urls in 1 post.
In facebook debugger i'm passing json like that
{
"message": "test debug",
"child_attachments": [
{
"link": {
"link": "https://google.com"
}
},
{
"link": {
"link": "https://ft.com"
}
}
]
}
but i'm getting following error message
{ "error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_data": {
"blame_field_specs": [
[
"child_attachments[0][link]"
]
]
},
"error_subcode": 2061006,
"is_transient": false,
"error_user_title": "URL Can't Be Used",
"error_user_msg": "The URL you entered, \"https://google.com\" doesn't direct to a website. Please enter a valid URL and try again.",
"fbtrace_id": "xxxxxxxx"
}
}
i've tried setting urls in app domains , i tried use urls with / without https and with/without www.
still no luck, can some one give me some advise?
Thanks,
Roman.
ok, so i figured, the correct format should be like that:
{
"message": "message to post",
"link": "https://yahoo.com",
"child_attachments": [
{
"link": "https://yahoo.com",
"name": "name -1",
"picture": "https://images.all-free-download.com/images/graphiclarge/ethereal_image_185195.jpg"
},
{
"link": "https://google.com",
"name": "name - 2 ",
"picture": "https://images.all-free-download.com/images/graphiclarge/ethereal_image_185195.jpg"
}
]
}
note that even despite of the thing you adding links in the child_attachments, you must provide 'link' parameter also for post
Im trying to send a email template along with a URL whose click count should be tracked using SparkPost APIs?
Example: if I give www.google.com its has to change to
http://go.sparkpostmail1.com/f/a/EgvUoS2LdGPzMx-AURKwZA~~/AABUGAA~/RgRZK0BSP0EIAGukLuGW3OxXA3NwY1gEAAAAAFkGc2hhcmVkQgoAAVK7SFdpNVEbUhFuaWNvbGFzQGR1cmFuZC5jaAlRBAAAAABEUWh0dHBzOi8vZGlzaGx5Lm1lbnUvZC9XYXNoaW5ndG9uL1JlZ2VudF9UaGFpL0Jhc2lsX0phZS81NjBmMzk5MmQ0YWUxNTAzMDBmZWZmMGIiLEcCe30.
POST /api/v1/transmissions?num_rcpt_errors=3
{
"options": {
"start_time": "now",
"open_tracking": true,
"click_tracking": true,
"transactional": false,
"sandbox": false,
"ip_pool": "sp_shared",
"inline_css": false
},
"description": "Christmas Campaign Email",
"campaign_id": "christmas_campaign",
"metadata": {
"user_type": "students",
"education_level": "college"
},
"substitution_data": {
"sender": "Big Store Team",
"holiday_name": "Christmas"
},
"recipients": [
{
"address": {
"email": "wilma#flintstone.com",
"name": "Wilma Flintstone"
},
"tags": [
"greeting",
"prehistoric",
"fred",
"flintstone"
],
"metadata": {
"age": "24",
"place": "Bedrock"
},
"substitution_data": {
"customer_type": "Platinum",
"year": "Freshman"
}
}
],
"content": {
"from": {
"name": "Fred Flintstone",
"email": "fred#flintstone.com"
},
"subject": "Big Christmas savings!",
"reply_to": "Christmas Sales <sales#flintstone.com>",
"headers": {
"X-Customer-Campaign-ID": "christmas_campaign"
},
"text": "Hi \nSave big this Christmas in your area ! \nClick http://www.example.com and get huge discount\n Hurry, this offer is only to \n ",
"html": "<p>Hi \nSave big this Christmas in your area ! \nClick http://www.example.com and get huge discount\n</p><p>Hurry, this offer is only to \n</p><p></p>"
}
}
To enable "click tracking", set options.click_tracking=true field in your request. You have already done this but it looks like your links in the content.html are not HTML anchors (<a> tags) but just plain text links.
SparkPost will only track HTML anchors so I suggest changing this:
http://www.example.com
to this:
www.example.com
I am using the Mandrill PHP-API Class to send bulk mail to my clients. And was wondering why dose Mandrill only recognize a few of my 'recipient_metadata' Merge Tags?
The Mandrill Api Request is :
{
"message": {
"from_email": "me#example.com",
"from_name": "Bengwela Stream",
"headers": {
"Reply-To": "me#example.com"
},
"important": false,
"track_opens": true,
"track_clicks": true,
"auto_text": null,
"auto_html": null,
"inline_css": null,
"url_strip_qs": null,
"preserve_recipients": false,
"tracking_domain": null,
"signing_domain": null,
"tags": [
"CODE"
],
"merge": true,
"metadata": {
"sendtype": "demorun"
},
"to": [
{
"email": "to#example.com",
"name": "Bob "
}
],
"subject": "CODE L1",
"recipient_metadata": [
{
"rcpt": "bob#example.com",
"vars": [
{
"name": "A",
"content": 3
},
{
"name": "email",
"content": "bob#example.com"
},
{
"name": "invoice",
"content": "123456"
},
{
"name": "SITE",
"content": "http://example.com"
}
]
}
],
"html": " <!DOCTYPE html PUBLIC \" ....Complex.... *|A|* *|email|* *|invoice|* *|SITE|* ",
"text": " *|A|* *|email|* *|invoice|* *|SITE|* ",
},
"async": true,
"ip_pool": null,
"send_at": null,
"key": "123456456645"
}
But in both any TEXT and EMAIL Live send, only |A| |email| are replaced.
I'm most probably messed some thing up here. But I can't see what. :)
Thank you for any help.
To populate merge tags (the *|SOMETHING|*, you actually want to use the merge_vars and global_merge_vars parameters instead of the metadata parameters. Metadata allows you to add information to the message, but it's only for your tracking/analytics (more on metadata here). Nothing from the metadata parameters is used to populate merge tags or content in the message. The *|EMAIL|* merge tag is special - if you don't provide a value, we'll automatically fill in the recipient's email address by default.
So, in your API call, you should just be able to replace recipient_metadata with merge_vars and have those merge tags get populated as expected.
For more on working with merge tags, check out the KB article here: http://help.mandrill.com/entries/21678522
And if you're still running in to issues, you can contact support to look at the actual API call(s) you're making. Just click the 'Help' link in the footer when logged in to your account.