Reputation: 49
hi I am sending the from my windows base app using the following code
Mail.Subject = "test email"
Mail.To.Add("[email protected]")
Mail.From = New MailAddress("[email protected]")
Mail.Body = "Hello"
Dim attachment As System.Net.Mail.Attachment
attachment = New System.Net.Mail.Attachment("AttachPath")
Mail.Attachments.Add(attachment)
Dim SMTP As New SmtpClient("smtp.abc.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("[email protected]", "password")
SMTP.Port = 25
SMTP.Send(Mail)
but I dont want to use
SMTP.Credentials = New System.Net.NetworkCredential("[email protected]", "password")
and also Interpub
can anyone have solution for this
Upvotes: 0
Views: 3814
Reputation: 14113
The best thing you can do to secure your credentials is to hide them from plain sight. A typical end user will probably never ever think about using a tool like ILSpy to steal your password, so don't worry about them. Other tricks involve obfuscating the username/password, so that it becomes incredibly time-consuming for anyone to figure out where in your code the username/password are coming from.
If all you're doing is uploading files, my ultimate recommendation would be to use a different technology that doesn't require authentication. For example, you can set up an FTP/SFTP server which allows anonymous read/write access to a folder "crash reports" (I'll just assume that's what you're doing). I believe some servers even allow creating files, but deny modifying/deleting files.
Upvotes: 0
Reputation: 8004
You can also set this up in the My.Settings area and then reference it when needed, BUT not as secure either because you can open this up and view freely... Either way you still have to provide YOUR credentials on a secure mail server in some fashion so the server can authenticate you when logging on. There are many ways to do this for example you can: write to a random text file with your credentials somewhere on the PC or pull them from a database.
Upvotes: 1
Reputation: 2306
If you dont want to use that specific line of code, I guess you need to configure your server so that it allows anonymous authentication.
Or if that was not your intention, you can use the DefaultCredentials
:
SMTP.Credentials = CredentialCache.DefaultCredentials
More information can be found here:
Upvotes: 0