(201026) 메일발송 수정 (smtp, 파일첨부)
This commit is contained in:
parent
406405bb87
commit
db680b674a
|
|
@ -14,7 +14,7 @@
|
|||
<div style="width:100%; max-width:900px; margin:0 auto; font-family: 'Noto Sans KR','Malgun Gothic', dotum, sans-serif;">
|
||||
|
||||
|
||||
<div style="padding: 10px;box-sizing:border-box;border-bottom:2px solid #333583;color: #555;font-size: 24px;font-weight: 600;background: url('https://cnr.nptc.kr/img/common/gnb_logo.png')no-repeat left center;height: 80px;">
|
||||
<div style="padding: 10px;box-sizing:border-box;border-bottom:2px solid #333583;color: #555;font-size: 24px;font-weight: 600;background: url('/css/img/intranet_logo_b.gif')no-repeat left center;height: 80px;">
|
||||
<span style="padding-left: 140px;vertical-align: -webkit-baseline-middle;"></span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@
|
|||
<add key="fronturl" value="https://www.ynicte.com" />
|
||||
<add key="adminurl" value="http://admin.ynicte.com" />
|
||||
<add key="isstaging" value="1" />
|
||||
<add key="masteremail" value="edu@ynicte.or.kr;mail.ynicte.or.kr;25;ynicte@ynicte.or.kr;k7758870!%" />
|
||||
<!--<add key="masteremail" value="edu@ynicte.or.kr;mail.ynicte.or.kr;25;ynicte@ynicte.or.kr;k7758870!%" />-->
|
||||
<add key="masteremail" value="yicte@cte.or.kr;smtp.daum.net;465;yicte2020;yicte04003" />
|
||||
<add key="usessl" value="N" />
|
||||
<add key="daokey" value="ynictelms2020" />
|
||||
|
||||
|
|
|
|||
|
|
@ -926,8 +926,8 @@ namespace NP.Base
|
|||
mail.Body = Html.Replace("src=\"" + files.Files + "/Editor", "src=\"" + GetConfig("fronturl") + "/Files/Editor");
|
||||
if (!string.IsNullOrEmpty(strFile))
|
||||
{
|
||||
System.Net.Mail.Attachment attachment;//첨부파일 만들기
|
||||
attachment = new System.Net.Mail.Attachment(strFile);//첨부파일 붙이기
|
||||
System.Web.Mail.MailAttachment attachment;//첨부파일 만들기
|
||||
attachment = new System.Web.Mail.MailAttachment(strFile);//첨부파일 붙이기
|
||||
mail.Attachments.Add(attachment);//첨부파일 붙이기
|
||||
}
|
||||
|
||||
|
|
@ -954,6 +954,7 @@ namespace NP.Base
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SendMailTemplate
|
||||
/// </summary>
|
||||
|
|
@ -966,6 +967,7 @@ namespace NP.Base
|
|||
/// <param name="fileName"></param>
|
||||
/// <param name="fileInputStream"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete]
|
||||
public int SendMailTemplate(string templateType, string sdEmail, string sdName, string rcvEmail, string title, string[] contents, string fileName, string bans = "")
|
||||
{
|
||||
var smtp = GetConfig("masteremail").Split(';');
|
||||
|
|
@ -976,12 +978,11 @@ namespace NP.Base
|
|||
|
||||
try
|
||||
{
|
||||
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
|
||||
mail.From = new System.Net.Mail.MailAddress(sdEmail, sdName, System.Text.Encoding.UTF8);
|
||||
mail.To.Add(rcvEmail);
|
||||
MailMessage mail = new MailMessage();
|
||||
mail.From = sdEmail;
|
||||
mail.To =rcvEmail;
|
||||
mail.Subject = title;
|
||||
mail.SubjectEncoding = System.Text.Encoding.UTF8;
|
||||
mail.IsBodyHtml = true;
|
||||
mail.BodyFormat = MailFormat.Html;
|
||||
mail.Body = string.Empty;
|
||||
mail.BodyEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
|
|
@ -1005,16 +1006,24 @@ namespace NP.Base
|
|||
mail.Body = template_emailText.Replace("src=\"" + files.Files + "/Editor", "src=\"" + GetConfig("fronturl") + "/Files/Editor");
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
System.Net.Mail.Attachment attachment;
|
||||
attachment = new System.Net.Mail.Attachment(fileName);
|
||||
System.Web.Mail.MailAttachment attachment;
|
||||
attachment = new System.Web.Mail.MailAttachment(fileName);
|
||||
mail.Attachments.Add(attachment);
|
||||
}
|
||||
using (System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(smtphost, smtpport))
|
||||
{
|
||||
SmtpServer.Credentials = new System.Net.NetworkCredential(smtpid, smtppw);
|
||||
//SmtpServer.EnableSsl = true;
|
||||
SmtpServer.Send(mail);
|
||||
}
|
||||
int cdoBasic = 1;
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", true);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", smtpport);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", smtpid);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", smtppw);
|
||||
SmtpMail.SmtpServer = smtphost;
|
||||
SmtpMail.Send(mail);
|
||||
//using (System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(smtphost, smtpport))
|
||||
//{
|
||||
// SmtpServer.Credentials = new System.Net.NetworkCredential(smtpid, smtppw);
|
||||
// //SmtpServer.EnableSsl = true;
|
||||
// SmtpServer.Send(mail);
|
||||
//}
|
||||
//SmtpServer.Host = smtphost;
|
||||
//SmtpServer.Port = Convert.ToInt32(smtpport);
|
||||
//SmtpServer.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@
|
|||
<!--<add key="SIP" value="192.168.0.58" />-->
|
||||
<add key="fronturl" value="https://www.ynicte.com" />
|
||||
<add key="adminurl" value="http://admin.ynicte.com" />
|
||||
<add key="masteremail" value="edu@ynicte.or.kr;mail.ynicte.or.kr;25;ynicte@ynicte.or.kr;k7758870!%" />
|
||||
<!--<add key="masteremail" value="edu@ynicte.or.kr;mail.ynicte.or.kr;25;ynicte@ynicte.or.kr;k7758870!%" />-->
|
||||
<add key="masteremail" value="yicte@cte.or.kr;smtp.daum.net;465;yicte2020;yicte04003" />
|
||||
<add key="usessl" value="N" />
|
||||
<add key="ssonoauth" value="Y" />
|
||||
<add key="daokey" value="ynictelms2020" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue