<p>I'd like my program to be able to email me error reports. How can I do this without hard-coding a username/password/SMTP server/etc. into the code? (Doing so would allow users to decompile the program and take over this email account.)</p>

<p>I've been told you could do some stuff with telneting to port 25, but I'm very fuzzy on the details. Most of the code snippets on Google assume you have a preexisting account, which doesn't work in this situation.</p>

<p>I am using .NET v3.5 (C# in particular), but I would imagine the ideas are similar enough in most languages. As long as you realize I'm doing this for an offline app, and don't supply me with PHP code or something, we should be fine.</p>

[{'answer_id': 29997, 'author': 'Chris Marasti-Georg', 'author_id': 96, 'author_profile': 'https://Stackoverflow.com/users/96', 'pm_score': 1, 'selected': False, 'text': '<p>If the program has to email you directly, it has to get that information somehow, so a determined attacker could gain that information as well.</p>\n\n<p>Have you considered hosting a simple http form or web service somewhere, so that you could post the information you need there from the application (no authentication required), and either save it to manually look at later, or send the email from that server?</p>\n'}, {'answer_id': 30001, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 4, 'selected': True, 'text': '<p>As long as your account is on gmail.com, set up <strong>gmail-smtp-in.l.google.com</strong> as the outgoing SMTP-server in your program. You do not need to provide a password to send email to gmail-accounts when using that server.</p>\n'}, {'answer_id': 30002, 'author': 'Biri', 'author_id': 968, 'author_profile': 'https://Stackoverflow.com/users/968', 'pm_score': 3, 'selected': False, 'text': "<p>I would create a webservice to connect to. This webservice should send the email based on the data your program provide. All sensitive access-data is kept on the webservice side, so it's safer.</p>\n"}, {'answer_id': 30006, 'author': 'Matt Sheppard', 'author_id': 797, 'author_profile': 'https://Stackoverflow.com/users/797', 'pm_score': 0, 'selected': False, 'text': "<p>I think the best plan would be to submit the error information to some service (in the simple case, a web form) running under your control, which could then send an email (or log it in some other appropriate way).</p>\n\n<p>If sending the email is assumed to be of benefit to the end user, another option would be to have the user enter their own SMTP server (and username / password if required) - On Unix systems, you can possibly just use sendmail and rely on the user to have it configured correctly. I used to work on a system which used this approach to send the user reports of the system's scheduled tasks, and that worked quite well.</p>\n"}, {'answer_id': 30007, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': -1, 'selected': False, 'text': '<pre><code>MailMessage msg = new MailMessage("someone@foo.com", "someoneelse@bar.com");\nmsg.Subject = "Check it out!";\nmsg.Body = "Visit stackoverflow.com!";\nSmtpClient client = new SmtpClient("some.smtp.server", 25);\nclient.Send(msg);\n</code></pre>\n'}, {'answer_id': 4619585, 'author': 'P-L', 'author_id': 511105, 'author_profile': 'https://Stackoverflow.com/users/511105', 'pm_score': 0, 'selected': False, 'text': "<p>What you need to do is knowing the SMTP server of the ISP you are using because when you use the SMTP server of your own ISP, you aren't considered as doing mail-relay spam so you can go through without any authentication.</p>\n\n<p>Unfortunately, it's not always possible to get that information easily OR there's some small exception which wouldn't let you log in anonymously like when you're using Exchange in a company...</p>\n\n<p>At first I thought about encrypting your informations and decrypt them during runtime but it would still be available by sniffing the network card. You could however combine that with a webservice somewhere which would do the decrypt and the mailing for you (or directly send information to the web service, which ever you prefere) like already suggested by others.</p>\n"}]
['https://Stackoverflow.com/questions/29988', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3191/']