Deploying my C# app on Appharbor triggers Mailgun email failures with error ‘Domain not found: smtp.mailgun.org’. Local tests pass. See new code sample below. Any guidance?
string mailDomain = System.Configuration.ConfigurationManager.AppSettings["MAIL_DOMAIN"];
string mailSecret = System.Configuration.ConfigurationManager.AppSettings["MAIL_SECRET"];
var mailService = new MailService(mailDomain, mailSecret);
var email = new System.Net.Mail.MailMessage($"noreply@{mailDomain}", "[email protected]") {
Subject = "Test Email",
Body = "This is a Mailgun test email."
};
mailService.Dispatch(email);
hey, i had similar issuues. check your mailgun domain in the config on appharbor, looks like a mismatched enviroment variable issue. try reuploading your env settings or updating them
The issue I encountered was similar to what your code is experiencing on Appharbor. I found that inconsistencies between local and deployed configuration files were the root of the problem. It was essential to double-check that the MAIL_DOMAIN settings correctly reflect the domain registered with Mailgun. In my case, I had to update the configuration through the settings panel directly on Appharbor instead of relying solely on local configuration files. Making sure that both the domain and secret were exactly as specified by Mailgun resolved the issue for me.