07 Mart 2010, 15:38
|
#1 |
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
| C#.NET MAIL Gonderme..
Kod: Kodu kopyalamak için üzerine çift tıklayın!
#region SMTP Mail Gönder
public bool sendEmail(
string pEmail,
string pPassword,
string pTo,
string pSubject,
string pBody,
System.Web.Mail.MailFormat pFormat,
string pAttachmentPath)
{
try
{
System.Web.Mail.MailMessage myMail = new System.Web.Mail.MailMessage();
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpserver",
"smtp.webadresi.gov.tr");
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
"25");
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendusing",
"2");
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendusername",
pEmail);
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendpassword",
pPassword);
/*myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpusessl",
"true");*/
myMail.From = pEmail;
myMail.To = pTo;
myMail.Subject = pSubject;
myMail.BodyFormat = pFormat;
myMail.Body = pBody;
if (pAttachmentPath.Trim() != "")
{
MailAttachment MyAttachment =
new MailAttachment(pAttachmentPath);
myMail.Attachments.Add(MyAttachment);
myMail.Priority = System.Web.Mail.MailPriority.High;
}
System.Web.Mail.SmtpMail.SmtpServer = "smtp.webadresi.gov.tr:25";
System.Web.Mail.SmtpMail.Send(myMail);
return true;
}
catch (Exception ex)
{
throw;
}
}
#endregion |
| |