I want to develop an automated email application in asp.net with c#

86 views Asked by At

I am able to send an email on the press of a button using smtp in asp.net but in doing so, I am forced to enter the senders email address and password as strings in the code. Is there any way to do this securely without needing to send the credentials as plain text? I am new to this and hence my knowledge about encryption and other stuff's is bare minimal.

1

There are 1 answers

0
mstaessen On

If you use (remote) authenticated SMTP, you need to authenticate with the server that will send the email. You could configure a mail server with non-authenticated SMTP on localhost (and only accept non-authenticated calls from localhost!). This way you don't need to enter credentials.

You could also use mail services like mailgun, where you can use a REST service to send email.

Credentials are hard to deal with. It is best to restrict the number of systems with access to credentials to the machines that you manage yourself (and have restricted access) or the machines (and their users) that you trust.