Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/* https://stackoverflow.com/questions/298363/how-can-i-make-smtp-authenticated-in-c-sharp */ using System.Net; using System.Net.Mail; using(SmtpClient smtpClient = new SmtpClient()) { var basicCredential = new NetworkCredential("username", "password"); using(MailMessage message = new MailMessage()) { MailAddress fromAddress = new MailAddress("from@yourdomain.com"); smtpClient.Host = "mail.mydomain.com"; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = basicCredential; message.From = fromAddress; message.Subject = "your subject"; // Set IsBodyHtml to true means you can send HTML email. message.IsBodyHtml = true; message.Body = "
your message body
"; message.To.Add("to@anydomain.com"); try { smtpClient.Send(message); } catch(Exception ex) { //Error, could not send the message Response.Write(ex.Message); } } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)