> For the complete documentation index, see [llms.txt](https://docs.axuslab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.axuslab.com/1.-common-structures/mail_system.md).

# 메일 연동 - Mail System

Mail System

#### 설명

메일 시스템은 대부분의 애플리케이션에서 매우 일반적인 작업입니다. Axs는 간단한 방법으로 전자 메일을 보낼 수 있는 기본 인프라를 제공합니다.

#### 예제

```csharp
public class TaskManager : IDomainService
{
    // 내부에서 사용할 변수로 선언합니다.
    private readonly IEmailSender _emailSender;

    // 메일 전송용 객체를 종속성 주입을 통해 가져옵니다.
    public TaskManager(IEmailSender emailSender)
    {
        // 메일 전송용 인스턴스를 내부 변수에 할당합니다.
        _emailSender = emailSender;
    }

    // 메일전송 메서드
    public void SendMail(MailInfo mailInfo)
    {
        // 메일 전송
        _emailSender.Send(
            to: mailInfo.EmailAddress,
            subject: $"메일 제목 {mailInfo.Title}",
            body: $"메일 본문 {mailInfo.Content}",
            isBodyHtml: true
        );
    }
}
```

#### 확인

아래와 같이 SendMail을 호출해서 테스트를 해 볼 수 있다.

![picture 2](https://973433021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35tSm8dhwtRBSQhjeoCu%2Fuploads%2Fgit-blob-1e99dadc63a66ab949548b3c05e08ef900ace16f%2Ffbcb3770a69d8f1e2ecb360a917a31900e9c795b9add2396b39b0eeab9ad0387.png?alt=media)

실제 메일은 발송이 되지 않고, 메일 서버 환경구성이 되면 발송이 될 것입니다.
