What should be the code for firing e-mail

Posted by Abhi_patil under ASP.NET on 2/5/2009 | Views : 1252 | Status : [Member] | Replies : 3
i have a link as EMAIL. After click on this link the email should fire to perticular logged user.




Responses

Posted by: Poster on: 2/5/2009 [Member] Starter

Up
0
Down
Not get your requirement, can you describe further?

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amansandha on: 2/5/2009 [Member] Starter

Up
0
Down
hi friend

pl first of all store the email id of login user at registration time
when a user loged in then u pick the email id from database and

add namespace System.Web.mail;
write this code on the click of that link button

try
{
MailMessage msg = new MailMessage();

msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.domain.com";
// set SMTP server port
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 25;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;

msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
// set SMTP username
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "emailid@domain.com";
// set SMTP user password
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "password";

msg.From = "emailid@domain.com";
msg.To = toaddress@domain.com/ textmail.text;
msg.Subject = "Subject";
msg.Body = "body text which u want to send to user login;
SmtpMail.SmtpServer = "mail.domain.com";
SmtpMail.Send(msg);

}
catch (Exception ee)
{
//Response.Write("Server Not Responding");
ee.Message.ToString();
}
finally
{
Literal1.Text = "Request sent to :" + txtmail.Text;
txtmail.Text = "";

}


Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi_patil on: 2/9/2009 [Member] Starter

Up
0
Down
Thank you.

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response