SMTP Client , should my customers change it for their own?

I am sending an email like this from my console app, the value for Subject, SMTP, etc.. 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

Answers (1)

Jim Mischel
Jim Mischel

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:

  1. The client is now tied to your SMTP service. If you shut down that server or your credentials change, then the client won't be able to send mail.
  2. The client has your SMTP credentials. Somebody could get those credentials from the config file and do bad things with your account.
  3. If your client decides to spam others using your credentials, your SMTP service could get marked as a spammer, and nobody will be able to send email from your account.

All things considered, you're much better off having your clients use their own SMTP settings for this.

Upvotes: 2

Related Questions