| Nucleus Login | Lost password? | Close |
|---|---|---|
| Username (email): | ||
| Password: | ||
|
|
||
|
|
||
ASP.NET: Sending e-mail
Problem
How can I send an e-mail via ASP.NET?
Article ID: #KB00041
Number of views: 1482x
Created: 19 May 2008
Latest change: 19 May 2008
Number of views: 1482x
Created: 19 May 2008
Latest change: 19 May 2008
Solution
You can send e-mails in ASP.NET thanks to the SmtpMail.Send() function.This function has the following parameters:
Send(
from (the address of the sender)
to (the address of the receiver)
subject (the subject of the e-mail)
message (your e-mail message)
)
You can send a simple e-mail using the following code:
String van = "name@domain.be";
String naar = "receiver@domain.be";
String onderwerp = "My message";
String bericht = "Dear receiver," + Environment.NewLine
+ "Tihs is a simple message!" + Environment.NewLine
+ "regards";
System.Web.Mail.SmtpMail.Send(van, naar, onderwerp, bericht);
Environment.NewLine matches a new line.
