-
Notifications
You must be signed in to change notification settings - Fork 862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SendEmailAsync throws incorrect exception #3526
Comments
Hello @lonix1, Thank you for reporting the issue. I am able to reproduce this scenario using below minimal code sample.
static async Task Main(string[] args)
{
AmazonSimpleEmailServiceV2Client _sesClient = new AmazonSimpleEmailServiceV2Client();
var request = new SendEmailRequest
{
FromEmailAddress = "[email protected]",
Destination = new Destination { ToAddresses = new List<string> { "[email protected]" } },
Content = new EmailContent
{
Simple = new Message
{
Subject = new Content { Data = "This is Test email" },
Body = new Body
{
Html = new Content { Data = "This is HTML Content" },
Text = new Content { Data = "This is Text Content" }
}
}
},
};
try
{
var response = await _sesClient.SendEmailAsync(request);
Console.WriteLine(response.MessageId);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
} Exception:
I will review it with the team to further investigate the issue. Regards, |
Per SESv2 > SendEmail, this service API throws below errors:
SimpleEmailV2 package in AWS .NET SDK is automatically generated from the service API models. Perhaps, we need to open ticket with SES service team to advise further. Thanks, |
Internal ticket with service team: P164679864 |
@lonix1 Good morning. Thanks for reporting the issue. Even though I have opened an issue with service team, I would request to verify some information. Per SendEmail, MailFromDomainNotVerifiedException is thrown when In our reproduction code below: static async Task Main(string[] args)
{
AmazonSimpleEmailServiceV2Client _sesClient = new AmazonSimpleEmailServiceV2Client();
var request = new SendEmailRequest
{
FromEmailAddress = "[email protected]",
Destination = new Destination { ToAddresses = new List<string> { "[email protected]" } },
Content = new EmailContent
{
Simple = new Message
{
Subject = new Content { Data = "This is Test email" },
Body = new Body
{
Html = new Content { Data = "This is HTML Content" },
Text = new Content { Data = "This is Text Content" }
}
}
},
};
try
{
var response = await _sesClient.SendEmailAsync(request);
Console.WriteLine(response.MessageId);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
} it gave exception:
The SES service is complaining about the destination email address Please confirm the following:
Please also check Creating and verifying identities in Amazon SES for domain verification and verifying email identities. It talks about domain verification, may be in your use case, it's not done. Thanks, |
@lonix1 Received below communication from SES service team: This error is supposed to be thrown when the custom MAIL FROM domain on the identity is not verified. Custom MAIL FROM domain verification is different than domain verification: https://docs.aws.amazon.com/ses/latest/dg/mail-from.html The docs for V1 mentions this: https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/SimpleEmail/TMailFromDomainNotVerifiedException.html The response of "Message rejected: Email address not verified" is therefore expected when they are using an unverified identity to send emails. If cx is using account in sandbox mode, both sender and recipient needs to be verified. If they are in production, they need to verify the sender domain/email only. Thanks, |
This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled. |
Comments on closed issues are hard for our team to see. |
Hi @ashishdhingra sorry for the late response, I think we are misunderstanding each other. I used similar code to yours and got the same result. I understand the difference between sender and receiver. The issue if I remember correctly is this:
But as you and @bhoradc verified in your own code, if you send from an unverified domain, it throws the latter instead of the former. We've moved on from this issue, but from what I can tell either 1) it is throwing the wrong exception, or 2) the docs must be updated. |
Describe the bug
SESv2: SendEmailAsync is supposed to throw MailFromDomainNotVerifiedException for a mail sent from an unverified domain.
However it actually throws a MessageRejectedException:
Since we use the exceptions to determine what failed, our code responds to failure incorrectly. This is obviously a problem.
I hope the other exceptions are working as intended.
Regression Issue
Expected Behavior
To work as documented.
Current Behavior
Throws incorrect exception.
Reproduction Steps
Send a mail via
SendEmailAsync
using an unverified domain.Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.SimpleEmailV2 3.7.403.1
Targeted .NET Platform
.NET 8
Operating System and version
linux
The text was updated successfully, but these errors were encountered: