Reputation: 863
I am sending an email like this from my console app, the value for Subject, SMTP, e
tc.. as you see in the code are configurable from the App.Config file so customer can type their own.
SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["SmtpHost"]);
client.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpPort"]);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(message);
I entered my own SMTP, Port
, etc.. info in the config file when I tested the application. Now that the customer wants to run it, do they have to type their own Port, SMTP, etc.. or still can use what I have typed there and just change the RecipientAddresses
?
NOTE: It doesn't have to be an email address that they can actually reply to. The program just needs to send a report after running to their real email address. It doesn't matter if the sender email address is real or not.
Upvotes: 0
Views: 79
Reputation: 134035
The answer is, "It depends."
If you want to give the client your SMTP credentials, and if your SMTP server is accessible from the client's site, then leaving your settings is just fine. I would caution against doing that, though, for a number of reasons:
All things considered, you're much better off having your clients use their own SMTP settings for this.
Upvotes: 2