달력

102021  이전 다음

  •  
  •  
  •  
  •  
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  
  •  
  •  
  •  

[WebMethod (Description="Simple mailer w/ authentication")]
public string SimpleMail(string mailto, string mailfrom, string mailsubject, string mailbody, string mailcc, string mailbcc, string smtpserver, string username, string password)
{
string _results = "success!";
MailMessage mm = new System.Web.Mail.MailMessage();
mm.From = mailfrom;
mm.To = mailto;
mm.Subject = mailsubject;
mm.Body = mailbody;
mm.Cc = mailcc;
mm.Bcc = mailbcc;
mm.BodyFormat = MailFormat.Text;

int cdoBasic = 1;
int cdoSendUsingPort = 2;

mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpserver);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 10);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", false);

try
{
System.Web.Mail.SmtpMail.Send(mm);
}
catch (Exception e)
{
_results = e.ToString();
}

return _results;

}

Posted by Tornado tornado

댓글을 달아 주세요