Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top