Click here to Skip to main content
15,906,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to send autogenerated mail with accept or reject button in c#
Posted

Hi,

I hope that this helps you.
C#
MailMessage MailMesaji = new MailMessage();
MailMesaji.Subject = "Hello";
MailMesaji.Body = " How are u";
MailMesaji.BodyEncoding = Encoding.GetEncoding("Windows-1254");
MailMesaji.From = new MailAddress("Email Sender @ Domain");
MailMesaji.To.Add(new MailAddress("Email Reciever @ Domain"));
SmtpClient Smtp = new SmtpClient("smtp.mail.yahoo.com");
OpenFileDialog Ofd = new OpenFileDialog();
if (Ofd.ShowDialog() == DialogResult.OK)
{
    string Att = Ofd.FileName;
    Attachment ATTa = new Attachment(Att);
    MailMesaji.Attachments.Add(ATTa);

}

Smtp.Credentials = new System.Net.NetworkCredential("Email Sender @ Domain", "");
Smtp.Send(MailMesaji);
MessageBox.Show("mail Send");
 
Share this answer
 
v2
Comments
Paramita Paul 23-Jun-12 6:44am    
Actually I wanted to know how i send mail with acception and rejection button that reciever when get mail must vote for either acception or rejection .
If you want any action in your mail than you have to send a link through our code which redirect in to your website. You have to do code what you want to do when user click on "Accept" or "Reject" in your page only. Through mail you can only send the parameters what actually you want to do either it is "Accept" or "Reject".

for example

HTML
<a href="http://www.yourwebsitename.com?att=acpt">Accept</a>

HTML
<a href="http://www.yourwebsitename.com?att=reject">Reject</a>

Note: It will be great if you send encrypted querystring, so that the user can't change anything.

This is the simplest solution i had given you. If you want button than you have to send your page through

action used in
HTML
<form>


Thanks
Ashish
 
Share this answer
 
v4
Comments
Paramita Paul 23-Jun-12 7:18am    
THANKS SIR....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900