
24.05.2010, 14:15
|
|
Участник форума
Регистрация: 09.02.2009
Сообщений: 229
Провел на форуме: 2856245
Репутация:
338
|
|
Через smtp с вложением
PHP код:
using System.Web;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
//Авторизация на SMTP сервере
SmtpClient Smtp = new SmtpClient("smtp.mail.ru", 2525);
Smtp.Credentials = new NetworkCredential("login", "pass");
//Smtp.EnableSsl = false;
//Формирование письма
MailMessage Message = new MailMessage();
Message.From = new MailAddress("from@mail.ru");
Message.To.Add(new MailAddress("to@mail.ru"));
Message.Subject = "Заголовок";
Message.Body = "Сообщение";
//Прикрепляем файл
string file = "C:\\file.zip";
Attachment attach = new Attachment(file, MediaTypeNames.Application.Octet);
// Добавляем информацию для файла
ContentDisposition disposition = attach.ContentDisposition;
disposition.CreationDate = System.IO.File.GetCreationTime(file);
disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
Message.Attachments.Add(attach);
Smtp.Send(Message);//отправка
А искал ты вот это
https://forum.antichat.ru/showpost.php?p=1039335&postcount=21
Последний раз редактировалось KATYA; 24.05.2010 в 14:20..
|
|
|