I have an issue with mailgun when send an email with cc param. But when I execute the method, I have got wrong header from cc email.
This is my code
var client = new RestClient
{
BaseUrl = new Uri("https://api.mailgun.net/v3"),
Authenticator = new HttpBasicAuthenticator("api", "secret-key")
};
var request = new RestRequest();
request.AddParameter("to", "[email protected]");
request.AddParameter("cc", "[email protected]");
client.Execute(request)
So, Can anyone please help me to resolve this?
This is information from email to
This is what I get from cc Email
Storing Messages through Routes You can store messages temporarily (up to 3 days) by creating a store() action using Routes.
Mailgun is a leading provider of email API services you can use to send, validate, and receive emails through your domain at scale. It also lets you track the performance of your sent emails with robust open, click, bounce, and delivery tracking.
Select your sandbox domain from among the domains list; you'll see the name as a long string starting with "sandbox." On the right-hand side of the resulting page, you will see a tile that allows you to enter a new or view an existing Authorized Recipient.
There is a limit of 300 messages per day on the included sandbox domain. Data retention for Logs and the Events API is 1 day. You cannot create custom domains. You can only send to Authorized Recipients; and there is a maximum of 5 Authorized Recipients.
Hm, I can't reproduce your problem. I'm getting the same mail message in both to and cc mailboxes with correct addresses. Here is a screen from cc mailbox:
To proceed with the problem, could you please do the following:
Update your question with the exact code you use for calling netgun API. Little things matter here and we should understand what makes difference between your and my calls.
Could you also please update your question with raw mail message got to cc mailbox. In gmail you could do it by clicking down arrow near reply button and selecting "Show original":
There will be a bunch of different headers in the message including to and cc:
Please share with us the whole mail packet you get.
Please add a request.Method = Method.POST;
in your code, because
according to official C# mailgun api documentation.
Could you try this code (with the same order) :
RestClient client = new RestClient ();
client.BaseUrl = new Uri ("https://api.mailgun.net/v3");
client.Authenticator =
new HttpBasicAuthenticator ("api",
"YOUR_API_KEY");
RestRequest request = new RestRequest ();
request.AddParameter ("domain", "YOUR_DOMAIN_NAME", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter ("from", "Email From <[email protected]>");
request.AddParameter ("to", "[email protected]");
request.AddParameter ("cc", "[email protected]");
request.AddParameter ("subject", "Email Subject");
request.AddParameter ("text", "Testing some Mailgun awesomness!");
request.AddParameter ("o:tracking", false);
request.Method = Method.POST;
return client.Execute (request);
Regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With