Tuesday, July 15, 2008

డాట్ నెట్ నుండి మెయిల్ ఎలా సెంద్ చెయ్యాలి ?

హాయ్,
డాట్ నెట్ ఉపయోగించి మెయిల్ పంపించాలంటే మీరు చేయాల్సింది .
1.Add the following code to web.config file

<appSettings>

<add key="SMTPServer" value="mail.mailserver.com"/>

<add key="SMTPServerUID" value="test@mailserver.com"/>

<add key="SMTPServerPWD" value="passwordtest"/>

<add key="SMTPServerPORT" value="25"/>

</appSettings>

<system.net>

<mailSettings>

<smtp from="test@mailserver.com">

<network host="mail.mailserver.com" password="passwordtest" userName="test@mailserver.com"/>

</smtp>

</mailSettings>

</system.net>

2.Add the following method to where you required in .cs పేజి
public void SendMail()
{
MailMessage objMail = new MailMessage();
objMail.From = new MailAddress("v_cherukuri@redsalsa.com", "Cherukuri Articles");
if (txtRecipient.Text.Trim() != "")
objMail.To.Add("cherukuri@venkateswarlu.co.in");
objMail.CC.Add("cherukuri@venkateswarlu.co.in");
objMail.Subject = "Article :: ";
objMail.Body = "Hi";
Send(objMail);
}

1 comment:

Anonymous said...

this is artice is very useful