Mail server rejecting mail (to a domain it controls) sent by MailGun - email

Here's the setup:
iRedMail server setup to send and receive emails. (send hand crafted emails)
MailGun service to send emails. (send automated computer generated mail)
Sending mail from MailGun to mail servers other than my iRedMail server instance, are accepted.
Sending mail to my iRedMail server from MailGun, are rejected with status code 450.
Paste below shows a MailGun log entry of an email, sent by MailGun, to my iRedMail server instance.
{
"severity": "permanent",
"tags": [],
"delivery-status": {
"tls": true,
"mx-host": "m1.managemun.org",
"code": 450,
"description": "",
"session-seconds": 1.262861967086792,
"utf8": true,
"retry-seconds": 14400,
"attempt-no": 8,
"message": "4.1.8 <bounce+595546.eb6855-omar=managemun.org#mg.managemun.org>: Sender address rejected: Domain not found",
"certificate-verified": true
},
"recipient-domain": "managemun.org",
"id": "1GWMCXnjTBKo5MlCth6Faw",
"campaigns": [],
"reason": "old",
"user-variables": {},
"flags": {
"is-routed": false,
"is-authenticated": true,
"is-system-test": false,
"is-test-mode": false
},
"log-level": "error",
"timestamp": 1507644954.828214,
"envelope": {
"transport": "smtp",
"sender": "contact#managemun.org",
"sending-ip": "XXX.XXX.XXX.XX",
"targets": "omar#managemun.org"
},
"message": {
"headers": {
"to": "omar#managemun.org",
"message-id": "6be3bf88-7725-7758-e995-XXXXXXXXXXXXX#managemun.org",
"from": "ManageMUN <contact#managemun.org>",
"subject": "Password Reset"
},
"attachments": [],
"size": 1656
},
"recipient": "omar#managemun.org",
"event": "failed"
}
How can I resolve this issue?
If you have any suggestions regarding the setup, please feel free to criticise constructively

The error returned is caused by Sender Address Verification. The recipient server performs a callback to the MX records of the Sender address to verify the envelope.mail-from address <bounce+595546.eb6855-omar=managemun.org#mg.managemun.org>.
In this case, the recipient server attempts the callback to "mg.managemun.org" but fails due to the subdomain not having MX records. Therefore, by adding Mailgun's MX records to your subdomain, mg.managemun.org, the MX lookups of those email servers will succeed, and the servers will accept your messages. The two MX records for Mailgun are or can be referenced here:
Value : mxa.mailgun.org
Priority: 10
Value : mxb.mailgun.org
Priority: 10
**Disclaimer I work at Mailgun

Related

Sending emails with SendGrid from a logic app to multiple recipients

Is there a simple way to send emails from an Azure logic app using SendGrid to multiple recipients, e.g. comma-separated etc?
This is how it looks now:
"actions": {
"Send_email_(V3)": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['sendgrid']['connectionId']"
}
},
"method": "post",
"body": {
"from": "webserver#hotmail.com",
"to": "firstaddress#somemail.com",
"subject": "** My subject **",
"text": "Some text",
"ishtml": ""
},
"path": "/v3/mail/send"
},
Is it possible to have
"to": "firstaddress#somemail.com, secondaddress#somemail.com"
?
The SendGrid V3 connector documentation states that you can separate the email addresses by comma in the To, CC or BCC fields:
Valid email addresses separated by a semicolon or comma
Checkout the documentation: SendGrid Connector

Custom_args not working in sendgrid V3 API but unique_args sends email but not in event_callback

I have used sendgrid v3 api for sending emails. As mentioned in documentation of V3 API I use custom_args to get my params in event callback but it shows 400 bad request, while I use unique_args, the email was sent but the event callback does not send my unique_args params.
data = {"content": [{"value": "dfafds", "type": "text/plain"}], "attachments": [{"content": "UEsDBB......QACAgIAAA=", "type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "content_id": "BqzZqz7LaqO9", "filename": "Contactmanager-company.xlsx", "disposition": "attachment"}], "from": {"email": "bishnusyangja#gmail.com"}, "personalizations": [{"to": [{"email": "bishnu#janakitech.com"}], "custom_args": {"email_msg_id": 106}, "subject": "daff"}]}
Event callback response from send grid is
[{"sg_event_id": "aoDNXRAeRuaCAVRiutD-fg",
"sg_message_id": "epJqlw1JThGw--dDTC1oCQ.filter0099p3las1-8681-5B853F95-29.0",
"smtp-id": "epJqlw1JThGw--dDTC1oCQ#ismtpd0006p1maa1.sendgrid.net",
"timestamp": 1535459222,
"email": "bishnu#janakitech.com",
"event": "processed"}]
I need may custom_args in event callback reponse, In this response I need email_msg_id What is missing here ?
In custom_args, data_type must be string. I fixed it using string data as
"custom_args": {'email_msg_id': '106'}.
While sending mail through java we need to send a unique id from my
side so that when webhook sends me the response I need to check the
status of that mail by its unique id. here is my code in java...
MimeMessage message = (MimeMessage) getNewMessageInstance();
message.addHeader("unique_args", jsonRandomEmailStatisticsId);
And value of jsonRandomEmailStatisticsId is like
{"unique_args":{"randomMessageId":"randomMessageId-308099455"}}
here I got a webhook response from SendGrid
[{
"category": [],
"email": "email#example.com",
"event": "processed",
"marketing_campaign_id": 12345,
"marketing_campaign_name": "campaign name",
"post_type": "event",
"sg_event_id": "sendgrid_internal_event_id",
"sg_message_id": "sendgrid_internal_message_id",
"sg_user_id": 12345,
"smtp-id": "",
"timestamp": 1442349428
}]
But SendGrid does not return random message id values in return of
object response

Paypal Batch Payout behavior on item error

With the batch payout API for Paypal, if I send a request with multiple items and there is an error with one of them, will the ones without an error still go through? Or will they all fail?
For example, if I sent a payload of:
{
"sender_batch_header": {
"sender_batch_id": "batch_8",
"email_subject": "You have a payment"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": 1.0,
"currency": "USD"
},
"receiver": "test_user#example.com",
"note": "Thank you.",
"sender_item_id": "item_1"
},
{
"recipient_type": "EMAIL",
"amount": {
"value": 1.0,
"currency": "USD"
},
"receiver": "bad_email_address",
"note": "Thank you.",
"sender_item_id": "item_1"
}]
}
Will the payout to test_user#example.com go through since the other item has an invalid email address?
Thanks
If you use
"receiver": "bad_email_address",
PayPal will throw out error as "bad_email_address" is not in email format, the whole payout can't go through, no money sent out.
If you use
"receiver": "bad_email_address#email.com",
The email address is not existed, but it's email format, the whole payment will go through, existed PayPal receiver will get the money, this un-existed email transaction will in Unclaimed status. If someone register this email address, then this person will get the money.

Mandrill sending to multiple people as separate message via the REST API

I'm trying to send out mails using mandrill. The problem is that when I add multiple recipients to the 'to' parameter, it sends out the same mail multiple times with ALL the recepients in the 'to' list. I was expecting the same mail to be sent out individually to every person in the to list. Am I missing something ?
{
"key": "app-key",
"template_name": "platform-invite",
"template_content": [
{
"name": "connection",
"content": "<a class=\"mcnButton \" title=\"Lets Go\" href=\"http://someurl\" target=\"_blank\" style=\"font-weight: normal;letter-spacing: normal;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;\">Lets go</a>"
},
{
"name": "mailbody",
"content": "<p>Hi </p>\n<p>I would like you to be a ... Tic tic tic...</p>"
}
],
"message": {
"subject": "My subject line over herer",
"from_email": "superman#mydomain.co",
"to": [
{
"email": "person1#gmail.com,
"type": "to"
},
{
"email": "person2#gmail.com",
"type": "to"
},
{
"email": "person3#gmail.com",
"type": "to"
},
{
"email": "person4#gmail.com",
"type": "to"
}
],
"merge_vars": {}
},
"async": false,
"ip_pool": "Main Pool"
}
There's an option in your Sending Options to expose recipients to one another. You can uncheck that box to not show everyone's information in the 'to' header. The option(s) you select in the Sending Options are used by default for your account. You can override any of these options in individual API calls. In this case, you could use the preserve_recipients parameter to override the current default that's set for your account.

Paypal REST AVS/CV2 codes

I'm using PayPal REST API via rest-api-sdk-java and would like to ask whether it is possible to get AVS/CVV match results in the response (or error object).
I did couple of tests (with sandbox and negative testing turned on) according to https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions/ (parts "Testing AVS errors" and "Testing CVV code"):
Payment request with billing address street "123 AVS_A Street" results in INTERNAL_SERVICE_ERROR:
{
"name": "INTERNAL_SERVICE_ERROR",
"debug_id": "baf56174e98c8",
"message": "An internal service error has occurred",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR"
}
The same payment request with billing address street "123 AVS_M Street" results in successful sale.
Is INTERNAL_SERVICE_ERROR expected error in such scenario (AVS_A) ? Is there any way how to get "raw AVS code" instead of INTERNAL_SERVICE_ERROR or CREDIT_CARD_REJECTED?
My request payload:
{
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"number": "4446283280247004",
"type": "visa",
"expire_month": 11,
"expire_year": 2018,
"cvv2": "888",
"first_name": "Susan",
"last_name": "Wagner",
"billing_address": {
"line1": "123 AVS_A Street",
"line2": "Billing Address Line 2",
"city": "London",
"country_code": "GB",
"postal_code": "W1T 2BU",
"state": "",
"phone": "12345"
}
}
}
]
},
"transactions": [
{
"amount": {
"currency": "GBP",
"total": "3.55",
"details": {
"shipping": "0.00",
"subtotal": "3.55",
"tax": "0.00"
}
},
"description": "T-Shirt XYZ"
}
]
}
And one more question: Is it possible to use advanced Fraud Management Filters on Sandbox environment? I'm using Pro test account but still can't use the filters (nothing happens when I click "upgrade now" button):
https://www.sandbox.paypal.com/uk/cgi-bin/webscr?cmd=_rc-manage
looking at the debug id, the test did work - sort of -
Internal Sandbox API Error is 10555 - Filter Decline
--> https://developer.paypal.com/webapps/developer/docs/classic/api/errorcodes/
The transaction was declined because of a merchant risk filter for AVS. Specifically, the merchant has set the filter to decline transactions when the AVS returns a partial match.
So you've likely enabled the AVS fraud management filter on the sandbox account.
Obviously, there should be a proper error message and not just an internal service error, but it looks like the error hasn't been mapped yet.
Will follow up with the PP Devs to report & fix it ;)
As for AVS / CVV response within REST - there doesn't seem to be a way to retrieve the AVS/CVV response of the issuing bank just yet.