2009. 5. 26. 14:37
#region 메일보내기[EasyMail]
public static void SencCDOMail(string strFrom, string strTo, string strSubject, string strBody)
{
// string strLicense = "abcd (Unlimited Developer)/A0C86200120615006940";
//
// EASYMAILSMTPLib.EasyMailSMTPObj objSMTP;
// objSMTP = new EASYMAILSMTPLib.EasyMailSMTPObj();
//
// objSMTP.LicenseKey = strLicense;
// objSMTP.MailServer = ConfigurationSettings.AppSettings["SmtpServer"];
// objSMTP.CharSet ="euc-kr";
// objSMTP.BodyFormat = 1;
// objSMTP.From = "EasyMail";
// objSMTP.FromAddr = strFrom;
// objSMTP.AddRecipient ("", strTo, 1);
// objSMTP.Subject = strSubject;
// objSMTP.BodyText = strBody;
//
// int x = objSMTP.Send();
CDO.MessageClass msg = new CDO.MessageClass();
CDO.ConfigurationClass conf = new CDO.ConfigurationClass();
ADODB.Fields Flds = conf.Fields;
Flds[CDO.CdoConfiguration.cdoSendUsingMethod].Value = ConfigurationSettings.AppSettings["SendUsingMethod"];
Flds[CDO.CdoConfiguration.cdoSMTPServer].Value = ConfigurationSettings.AppSettings["SmtpServer"];
Flds[CDO.CdoConfiguration.cdoSendUserName].Value = ConfigurationSettings.AppSettings["sendUserName"];
Flds[CDO.CdoConfiguration.cdoSendPassword].Value = ConfigurationSettings.AppSettings["sendPassword"];
Flds[CDO.CdoConfiguration.cdoSMTPAuthenticate].Value=1;//보내는메일인증
Flds.Update();
msg.Sender = ConfigurationSettings.AppSettings["Sender"];
msg.Configuration = (CDO.Configuration)conf;
msg.From = strFrom; //보내는 사람
msg.To = strTo; //받는 사람
msg.Subject = strSubject; //제목
msg.HTMLBody = strBody;
//파일 첨부(제가 만든 클래스의 속성입니다.collection)
// foreach(object an in email.AttachFiles)
// {
// //an = 파일전체 경로
// msg.AddAttachment(an.ToString(),"","");
// }
msg.Send();
Flds = null;
conf = null;
msg = null;
}
#endregion
'구 MiniHomepy > Experience' 카테고리의 다른 글
asp.net에서 딴 페이지로 post submit (0) | 2009.05.26 |
---|---|
asp.net 2.0 에서 예전 page에서 스크립트 쓰기 (0) | 2009.05.26 |
iframe 안의 파일에서 iframe 밖의 파일 제어 (0) | 2009.05.26 |