ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • c# E-Mail SMTP 발송
    Search: 카테고리 없음 카테고리 없음 2016. 2. 14. 02:40



    //System.Net.Mail


    MailMessage msg = new MailMessage("sender@mail.com", "receiver@mail.com",

              "Subject : Email sbj", "This is a mail test xxx");

     

    SmtpClient smtp = new SmtpClient("smtp.live.com", 587);

    smtp.EnableSsl = true;

     

    smtp.Credentials = new NetworkCredential("sender@mail.com", "password");

     

    smtp.Send(msg);



    //msg.From = new MailAddress(senderID, senderNAME, System.Text.Encoding.UTF8); //보내는 사람

    //msg.To.Add(Tmail); //받는 사람

    //msg.Subject = Tsub; //제목

    //msg.Body = Tbody; //내용

    //msg.IsBodyHtml = true;//본문에 html방식으로 삽입.

    //msg.BodyEncoding = System.Text.Encoding.UTF8;

    //msg.SubjectEncoding = System.Text.Encoding.UTF8;

    //System.Net.Mail.Attachment attachment;//첨부파일 만들기

    //attachment = new System.Net.Mail.Attachment(FileName);

    //mail.Attachments.Add(attachment);//첨부파일 붙이기

    //smtp.Port = 25; //포트 설정 서버 기본포트

    //smtp.Credentials = new System.Net.NetworkCredential(SMTPid, SMTPpass);

    //smtp.EnableSsl = false; //SSL 설정 (gmail은 true로 설정)




    댓글