전자 메일 발송 프로세스에서 C# 콘솔 응용 프로그램을 작성하려고합니다.ASP.Net 응용 프로그램 외부의 MailDefinition
MailMessage message = new MailMessage("[email protected]", "[email protected]", "Test message", "Test message content");
message.IsBodyHtml = true;
message.Body = "<a href=\"http://www.daringfireball.net\">DaringFireball.net</a>";
SmtpClient client = new SmtpClient("localhost"); // Your host here
try
{
client.Send(message);
}
catch (Exception e)
{
Console.WriteLine("There was an error trying to send the message: " + e.ToString());
}
나는 이러한 이메일이 더있을 수 있기 때문에 MailDefinition이 할 수있는 방법을 찾기 위해 노력했지만, 내가 조금으로 실행되었는지하는 과정에 : 나는 이메일을 간단하게 뭔가를 수행하여 외출이 문제. CreateMailMessage 메서드를 사용하려면 ASP.Net 응용 프로그램이 아니기 때문에 System.Web.UI.Control이 필요합니다.
누구에게이 문제가 발생 했습니까? 아니면 이것을하는 더 좋은 방법을 찾았습니까?
덕분에
'MailDefinition'이'MailMessage'가 할 수없는 파티에 가져 오는 것은 무엇입니까? –
@JimMischel -'MailDefinition'의'CreateMailMessage' 메소드는 텍스트 파일로부터 이메일 메시지를 생성하는 깔끔한 방법을 제공합니다. 'MailMessage'는 그런 것을 가지고 있지 않습니다. – Theophilus