PDA

View Full Version : attachment mail in c#



amir_civil
شنبه 16 اردیبهشت 1385, 06:18 صبح
سلام دوستان
من چندتا کد از سایت پیدا کردم ولی هیچکدوم جواب نداد
میشه سورسی چیزی برای راهنمایی بزارینc#2005
ممنون

dot_net_lover2
یک شنبه 17 اردیبهشت 1385, 22:27 عصر
private void butSendMail_Click(object sender, System.EventArgs e)
{
// Create the message.
MailMessage mailNew = new MailMessage();
// Set the message properties.
mailNew.From = "someone@microsoft.com";
mailNew.To = "jesse@contoso.com";
mailNew.Subject = "This is the subject text.";
mailNew.Body = "This is the message text.";
// Create an attachment.
MailAttachment atcItem = new MailAttachment
(Server.MapPath(Request.ApplicationPath) +
"\\joey.jpg");
// Attach it to the message.
mailNew.Attachments.Add(atcItem);
// Send the message.
SmtpMail.Send(mailNew);
}