(201026)비밀번호찾기, mail smtp 수정(다음 smtp는 Implicit SSL 이용, smtp client 는 explicit SSL 까지만 지원 변경)
This commit is contained in:
parent
7e16fdc249
commit
7635e02a16
|
|
@ -8,6 +8,7 @@ using System.Web.Mvc;
|
||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Web.Mail;
|
||||||
|
|
||||||
namespace NP.Base
|
namespace NP.Base
|
||||||
{
|
{
|
||||||
|
|
@ -885,6 +886,7 @@ namespace NP.Base
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 메일발송
|
/// 메일발송
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -895,9 +897,10 @@ namespace NP.Base
|
||||||
/// <param name="sbj"></param>
|
/// <param name="sbj"></param>
|
||||||
/// <param name="strFile"></param>
|
/// <param name="strFile"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[Obsolete]
|
||||||
protected int SendEmail(String smtphost, int smtpport, String smtpid, String smtppw, int SendType, String rcvEmail, String sdEmail, String sdName, String title, String Html, String strFile = null, string bans = "")
|
protected int SendEmail(String smtphost, int smtpport, String smtpid, String smtppw, int SendType, String rcvEmail, String sdEmail, String sdName, String title, String Html, String strFile = null, string bans = "")
|
||||||
{
|
{
|
||||||
System.Net.Mail.MailMessage mail = null;
|
System.Web.Mail.MailMessage mail = null;
|
||||||
switch (SendType)
|
switch (SendType)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -909,31 +912,40 @@ namespace NP.Base
|
||||||
String result = rcvEmail;
|
String result = rcvEmail;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mail = new System.Net.Mail.MailMessage();
|
mail = new System.Web.Mail.MailMessage();
|
||||||
mail.Subject = title;
|
mail.Subject = title;
|
||||||
mail.SubjectEncoding = System.Text.Encoding.UTF8;
|
mail.From = sdEmail; //보내는 사람 설정
|
||||||
mail.From = new System.Net.Mail.MailAddress(sdEmail, sdName, System.Text.Encoding.UTF8); //보내는 사람 설정
|
mail.To = rcvEmail; // 받는 사람 설정
|
||||||
mail.To.Add(rcvEmail); // 받는 사람 설정
|
|
||||||
mail.IsBodyHtml = true;
|
|
||||||
mail.BodyEncoding = System.Text.Encoding.UTF8;
|
mail.BodyEncoding = System.Text.Encoding.UTF8;
|
||||||
|
mail.BodyFormat = MailFormat.Html;
|
||||||
if ("" != bans)
|
if ("" != bans)
|
||||||
{
|
{
|
||||||
Html = Html.Replace("^ban0^",bans.Split(':')[0]).Replace("^ban1^", bans.Split(':')[1]);
|
Html = Html.Replace("^ban0^", bans.Split(':')[0]).Replace("^ban1^", bans.Split(':')[1]);
|
||||||
}
|
}
|
||||||
var files = new NP.Model.VMBase() { };
|
var files = new NP.Model.VMBase() { };
|
||||||
mail.Body = Html.Replace("src=\""+ files.Files +"/Editor", "src=\"" + GetConfig("fronturl") + "/Files/Editor");
|
mail.Body = Html.Replace("src=\"" + files.Files + "/Editor", "src=\"" + GetConfig("fronturl") + "/Files/Editor");
|
||||||
if (!string.IsNullOrEmpty(strFile))
|
if (!string.IsNullOrEmpty(strFile))
|
||||||
{
|
{
|
||||||
System.Net.Mail.Attachment attachment;//첨부파일 만들기
|
System.Net.Mail.Attachment attachment;//첨부파일 만들기
|
||||||
attachment = new System.Net.Mail.Attachment(strFile);//첨부파일 붙이기
|
attachment = new System.Net.Mail.Attachment(strFile);//첨부파일 붙이기
|
||||||
mail.Attachments.Add(attachment);//첨부파일 붙이기
|
mail.Attachments.Add(attachment);//첨부파일 붙이기
|
||||||
}
|
}
|
||||||
using (System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(smtphost, smtpport))
|
|
||||||
{
|
int cdoBasic = 1;
|
||||||
SmtpServer.Credentials = new System.Net.NetworkCredential(smtpid, smtppw);
|
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", true);
|
||||||
//SmtpServer.EnableSsl = true;
|
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", smtpport);
|
||||||
SmtpServer.Send(mail);
|
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);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ namespace NP.Base.Controllers
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
var MHtml = "<img src=\"" + fronturl + "/img/common/gnb_logo.png\" alt=\"\" /><br /><br />안녕하세요, " + user.username + "님,<br />당신의 영남건설기술교육원 비밀번호를 재설정하기 위한 링크를 전달합니다.<br />" +
|
var MHtml = "<img src=\"" + fronturl + "/img/common/gnb_logo.gif\" alt=\"\" /><br /><br />안녕하세요, " + user.username + "님,<br />당신의 영남건설기술교육원 비밀번호를 재설정하기 위한 링크를 전달합니다.<br />" +
|
||||||
"아래 링크를 클릭하셔서 비밀번호를 재설정해주세요.<br /><br />" +
|
"아래 링크를 클릭하셔서 비밀번호를 재설정해주세요.<br /><br />" +
|
||||||
"<a href=\"" + fronturl + "/Account/FindMe?pwcallno=" + pwcallno + "&userno=" + user.userno + "\" target=\"_blank\" style=\"color: #0094ff;\">비밀번호 재설정</a><br /><br />이 링크는 24시간 뒤 만료됩니다.";
|
"<a href=\"" + fronturl + "/Account/FindMe?pwcallno=" + pwcallno + "&userno=" + user.userno + "\" target=\"_blank\" style=\"color: #0094ff;\">비밀번호 재설정</a><br /><br />이 링크는 24시간 뒤 만료됩니다.";
|
||||||
//}
|
//}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue