문제

I'm trying to send a simple email to my users using AppHarbor and the MailGun addon. I also installed the MailGun NuGet package to send email easier from my C# code.

I get the following error:

System.InvalidOperationException: Domain not found

Here is the code I'm running:

/* Send welcome email. */
var client = new MailgunClient("foo.apphb.com", "key-1-jpn-190fj8102i3nf12i3fno213f");
client.SendMail(new System.Net.Mail.MailMessage("welcome@foo.apphb.com", "sergiotapia@outlook.com")
{
    Subject = "Hello from mailgun",
    Body = "this is a test message from mailgun."
});

Any ideas why this error message is popping up?

도움이 되었습니까?

해결책

You probably shouldn't use foo.apphb.com when configuring the MailGun client. I'm guessing, but you should probably use the MAILGUN_SMTP_SERVER configuration variable that's injected when your app is deployed on AppHarbor.

다른 팁

MailGun provides a Domain Name when you integrate with you application. Use this domain name here. It should be something similar to "abcd.mailgun.org".

ping foo.apphb.com, I for one get no response.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top