C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Sending email using .Net coding


Posted Date: 07 May 2008    Resource Type: Code Snippets    Category: C# Syntax
Author: Shilpa GinodeMember Level: Gold    
Rating: Points: 5



Suppose your application need to send email message this is how you go about.
Example:
SMTP server name is "smtp"
From Address: me@addres.com
To Address: to@Address.com


MailAddress mailfrom = New MailAddress("me@address.com");
MailAddress mailto = New MailAddress("to@address.com");
MailMessage mailmsg = New MailMessage(mailfrom,mailto);
mailmsg.Subject = "Greetings!";
mailmsg.Body = "Hi";
SmtpClient client = New SmtpClient("smtp");
client.Send(mailmsg);


Cheers
Shilpa




Responses

Author: UshaR    08 May 2008Member Level: Bronze   Points : 2
thanks it works well


Author: Kamal    08 May 2008Member Level: Gold   Points : 2
hi,

For More Detail check

Sending Email with ASP.NET 2.0


Author: Shilpa Ginode    08 May 2008Member Level: Gold   Points : 2
good it works...
Yaa this link is also good...


Author: vivek kushwaha    08 May 2008Member Level: Silver   Points : 2
'' here is another in asp.net/vb.net

Imports System.Web.Mail
Imports System.Web.Mail.SmtpMail

Dim _mm As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
_mm.From = "vivekkh@stercodigitex.com"
_mm.To = "vivekkh@stercodigitex.com"
_mm.Bcc = "vivek.kushwaha.mca@gmail.com"
_mm.Body = "Mail Things"
_mm.Subject = "hEllO ThEre"
_mm.BodyFormat = Mail.MailFormat.Html
System.Web.Mail.SmtpMail.Send(_mm)



Author: mani    08 May 2008Member Level: Silver   Points : 2
hey this is very much use full

MailMessage obj1 = new MailMessage();

obj1.From = "*****@gmail.com";
obj1.To = "*****@gmail.com";
obj1.Subject =txtFrom.Text +" is the sender "+ txtSubject.Text;
obj1.BodyFormat = MailFormat.Html;
obj1.Body = FreeTextBox2.Text;
SmtpMail.SmtpServer = "smtp.gmail.com";
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "******@gmail.com");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "********");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
SmtpMail.Send(obj1);



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: how can you formated Date in DD-Month-YYYY
Previous Resource: Plateform Invoke to call Win32 function
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use