I am sending emails through a node.js app to Mailgun. I keep getting these 421 Syntax error messages come up. Sometimes the messages do end up going through, here is the history for one message:
Date/Time Summary
2015-05-07 16:14 Delivered: sender → recipient 'You have a new notification'
2015-05-07 15:14 Will retry in 3600 seconds: sender → recipient 'You have a new notification' Server response: 421 421 Syntax error
2015-05-07 14:43 Will retry in 1800 seconds: sender → recipient 'You have a new notification' Server response: 421 421 Syntax error
2015-05-07 14:28 Will retry in 900 seconds: sender → recipient 'You have a new notification' Server response: 421 421 Syntax error
2015-05-07 14:18 Will retry in 600 seconds: sender → recipient 'You have a new notification' Server response: 421 421 Syntax error
2015-05-07 14:18 Accepted: sender → recipient 'You have a new notification'
*Email addresses redacted.
Here is what the log says for the 421 error:
{
"severity": "temporary",
"tags": [],
"delivery-status": {
"retry-seconds": 600,
"message": "421 Syntax error",
"code": 421,
"description": null,
"session-seconds": 0.16810393333435059
},
"envelope": {
"transport": "smtp",
"sender": sender,
"sending-ip": "184.173.153.222",
"targets": recipient
},
"recipient-domain": domain,
"id": "TdCQ8omOSwqj_zYq18CBdQ",
"campaigns": [],
"reason": "generic",
"user-variables": {},
"flags": {
"is-routed": null,
"is-authenticated": true,
"is-system-test": false,
"is-test-mode": false
},
"log-level": "warn",
"timestamp": 1431029901.450764,
"message": {
"headers": {
"to": recipient,
"message-id": "20150507201819.16176.81911#mailgundomain",
"from": sender,
"subject": "You have a new notification"
},
"attachments": [],
"recipients": [
recipient
],
"size": 1036
},
"recipient": recipient,
"event": "failed"
}
I am new to using Mailgun and I am building the emails RAW (headers and all). A 421 is supposed to be for network errors... so 'Syntax error' doesn't make sense to me.
Some of the messages go through fine, but I do have an awful lot that are getting retried.
Any thoughts?
Thanks
I created a ticket with Mailgun support and they quickly helped me find the answer:
The error that you are seeing is due to the recipient's server either
1). throttling emails sent from your domain which is also known as ESP
throttling, 2) grey-listing of the IP in which the recipient server will
first verify that the sending server is not sending spam before allowing
delivery, or 3) a local server issue may have occurred such as the server
being offline or misconfigured.
The error code of "4xx" indicates that this is a soft, temporary bounce.
Whenever we attempt to deliver a message and the recipient server returns a
soft bounce, we will retry delivery for up to 8 hours in the following
intervals: 10 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hour
and 4 hours. Unfortunately this cannot be adjusted and is hard coded in our
environment.
I checked with our admin and we had some anti-spam turned on for the mail server. We turned it off and no longer get '421 Syntax Errors'.
Thanks
Related
I am trying to send SMS through AWS SNS. Message body includes a URL to the webpage for user invite.
Messages work for Australia but when I send similar message to New Zealand, it fails.
If I remove URL from message body, SMS is sent otherwise it fails.
Here is the AWS cloudwatch log
{
"notification": {
"messageId": "..........",
"timestamp": "2021-10-25 14:18:44.002"
},
"delivery": {
"numberOfMessageParts": 1,
"destination": "+64........",
"priceInUSD": 0.12146,
"smsType": "Transactional",
"providerResponse": "Phone is currently unreachable/unavailable",
"dwellTimeMs": 1011,
"dwellTimeMsUntilDeviceAck": 3192
},
"status": "FAILURE"
}
Looking through AWS forums it says that one one the possibilities for this response can be invalid message body.
Interestingly if I add https://google.com in message body, SMS is sent.
I encountered the same issue. All of a sudden all of our SMS failed to send (our texts include a link). I tried sending various links all failed to send; however, www.google
I tried sending sms with amazon sns and I got
SMS message published to phone number +23481XXXXXXX successfully.
Message "ID": *********************
But the message status show "fail".
Please is there any other thing I have to do after verifying my account before I start sending sms?
You might also want to check if the region you're using supports sms and if the country you're trying to send has support.
https://docs.aws.amazon.com/sns/latest/dg/sns-supported-regions-countries.html
Not sure if this is just SNS related or if you're trying to send sms after an account was created in cognito, might want to check region support for that too
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html
You can activate Delivery status logging to obtain a more-detailed log for SMS messages.
From Viewing Amazon CloudWatch metrics and logs for SMS deliveries - Amazon Simple Notification Service:
Activate Delivery status logging
Send a message
View the results in Amazon CloudWatch Logs
Here is an example log entry:
{
"notification": {
"messageId": "1077257a-92f3-5ca3-bc97-6a915b310625",
"timestamp": "2016-06-28 00:40:34.559"
},
"delivery": {
"mnc": 0,
"destination": "+1XXX5550100",
"priceInUSD": 0.00645,
"smsType": "Transactional",
"mcc": 0,
"providerResponse": "Unknown error attempting to reach phone",
"dwellTimeMs": 1420,
"dwellTimeMsUntilDeviceAck": 1692
},
"status": "FAILURE"
}
I'm trying to send sms confirmation messages with Amazon SNS to the phones of users who sign up for an account using cognito and verify their phone numbers. My cognito user pool is located at us-east-2 and I recently got my spend limit increased to $50 for both us-east-1 and us-east-2. I tested sending sms messages through the sns console to my phone and that works perfectly. However, I don't get the sms messages when trying to verify users on cognito. When checking the sns console, it looks like the only successful messages that are being sent to my phone were my manual sent messages from the console and everything else has failed. Any help would be greatly appreciated.
I have found that the error comes for my specific phone number as a sprint carrier and get the following log failed response:
{
"notification": {
"messageId": "5dab56f3-2dd3-5a6d-b96e-0e96904d334b",
"timestamp": "2020-12-29 23:27:26.712"
},
"delivery": {
"phoneCarrier": "SPRINT Spectrum L.P.",
"mnc": 880,
"numberOfMessageParts": 1,
"destination": "+1******3252",
"priceInUSD": 0.00645,
"smsType": "Transactional",
"mcc": 311,
"providerResponse": "Blocked as spam by phone carrier",
"dwellTimeMs": 202,
"dwellTimeMsUntilDeviceAck": 1254
},
"status": "FAILURE"
}
However, I tested with an AT&T phone and TMobile phone and they get the messages delivered successfully with the following log response:
{
"notification": {
"messageId": "3106a00c-40de-53ce-9f40-f869fc025013",
"timestamp": "2020-12-29 23:24:12.183"
},
"delivery": {
"phoneCarrier": "T-mobile USA Inc.",
"mnc": 800,
"numberOfMessageParts": 1,
"destination": "+1******1131",
"priceInUSD": 0.00645,
"smsType": "Transactional",
"mcc": 310,
"providerResponse": "Message has been accepted by phone",
"dwellTimeMs": 238,
"dwellTimeMsUntilDeviceAck": 601251
},
"status": "SUCCESS"
}
This error is really weird to me as there should be no reason why SPRINT blocks my phone from getting sms messages from aws sns on cognito only but other phone services allow getting messages. I also still am able to get messages from the SNS console but only cognito fails to send with the carrier blocking it. Any help would be greatly appreciated!
Since you are able to receive SNS SMS from AT&T and T-Mobile phone carrier, I would strongly suggest that you contact AWS Premium Support to help you identify why SMS sent to SPRINT Spectrum L.P. are not being delivered.
I using sns of aws to send sms, when I log cloudwatch i see:
{
"notification": {
"messageId": "ac8d8d02-491d-58bf-ace8-xxxxxx",
"timestamp": "2021-01-01 00:03:54.576"
},
"delivery": {
"phoneCarrier": "Viettel",
"mnc": 4,
"numberOfMessageParts": 1,
"destination": "+843293xxxxx",
"priceInUSD": 0.0525,
"smsType": "Transactional",
"mcc": 452,
"providerResponse": "Message has been accepted by phone carrier",
"dwellTimeMs": 361,
"dwellTimeMsUntilDeviceAck": 2604
},
"status": "SUCCESS"
}
But in my phone, I don't get any message, How I fix it?
For several countries, senders are required to use a pre-registered alphabetic sender ID.
To request a sender ID from AWS Support, file a support request. Some countries require senders to meet specific requirements or abide by certain restrictions in order to obtain approval.
In these cases, AWS Support might contact you for additional information after you submit your sender ID request.
For further information about this, you can read this docs.
after the usual hair pulling efforts, I finally made AWSSimple Email Service push notifications to my REST end point through SNS and successfully applied the required business logic on those recipients.
Points:
You must be pushing multiple emails to that Recipient that's why more than one (unique) bounce notifications are being pushed by SNS.
Yes. And every notification has its own "messageId"
But why I am getting bounce Notifications for single recipient repeatedly, only, why not other wrong recipients.?
Response/s is attached:
{
"notificationType": "Bounce",
"bounce": {
"bounceType": "Permanent",
"bounceSubType": "Suppressed",
"bouncedRecipients": [
{
"emailAddress": "abc.xyz.aws#gmail.com",
"action": "failed",
"status": "5.1.1",
"diagnosticCode": "Amazon SES has suppressed sending to this ..."
}
],
"timestamp": "2017-12-28T07:06:37.106Z",
"feedbackId": "010101609bef62ff-0f30cac8-ec3c-41f3-9eee-5f7d90ef3c46-000000",
"reportingMTA": "dns; amazonses.com"
},
"mail": {
"timestamp": "2017-12-28T07:03:44.000Z",
"source": "abcXYZ#gmail.com",
"sourceArn": "arn:aws:ses:com-xyz-9:9696845301:identity/abcXYZ#gmail.com",
"sourceIp": "10.eee.ppq.lmn",
"sendingAccountId": "12365498512",
"messageId": "010101609bf1b35c-889e815e-b84c-4b08-a283-ee5f3e9740f2-000000",
"destination": ["abc.xyz.aws#gmail.com"]
}
}
Another one and all others:
{
"notificationType": "Bounce",
"bounce": {
"bounceType": "Permanent",
"bounceSubType": "Suppressed",
"bouncedRecipients": [
{
"emailAddress": "abc.xyz.aws#gmail.com",
"action": "failed",
"status": "5.1.1",
"diagnosticCode": "Amazon SES has suppressed sending to this ..."
}
],
"timestamp": "2017-12-28T07:06:37.106Z",
"feedbackId": "010101609befa8f5-a41662a5-b84e-4048-bc3a-d1f1469c8f1a-000000",
"reportingMTA": "dns; amazonses.com"
},
"mail": {
"timestamp": "2017-12-28T07:04:05.192Z",
"source": "abcXYZ#gmail.com",
"sourceArn": "arn:aws:ses:com-xyz-9:9696845301:identity/abcXYZ#gmail.com",
"sourceIp": "10.eee.ppq.lmn",
"sendingAccountId": "12365498512",
"messageId": "010101609bef61bb-310b4f29-0b01-4ecd-b763-b295e26d0732-000000",
"destination": ["abc.xyz.aws#gmail.com"]
}
}
For further info:
HTTP end point is is Spring MVC based REST controller.
Searching:
Through searching I found these:
1- Duplicate delivery/bounce notifications being sent to my SNS topic?
2- Emails being sent multiple times - can I see AWS logs ?
Kindly can any one help/guide or point out what can be the issue?
Hope you people are having a great holiday season.
"bounceSubType": "Suppressed",
This recipient is on the global suppression list, which means no SES customer can send mail to this address. It also means that these bounces are handled differently and more quickly than some other kinds of bounces.
https://aws.amazon.com/blogs/ses/goodbye-blacklist-introducing-the-suppression-list/
The bottom line here is that this bounce is a red flag to you that you need to manage your recipient addresses more carefully. Continuing to send messages to recipients on the suppression list is a signal to AWS that you may not be monitoring your bounces, or that you may not really be sending messages to people who actually want to receive them... and that in turn could potentially lead to enforcement actions.
If the emails you send result in excessive bounces, complaints, or other issues, your sending abilities might be placed on probation or suspended. This process is called enforcement.
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/e-faq.html