IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   C# (https://www.ircforumlari.net/c/)
-   -   C#.NET MAIL Gonderme.. (https://www.ircforumlari.net/c/320328-cnet-mail-gonderme.html)

toXic 07 Mart 2010 15:38

C#.NET MAIL Gonderme..
 
Kod:


#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



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 14:49.

Powered by vBulletin® Version 3.8.8 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2024 IRCForumlari.Net