Raysefo

Raysefo

  • 1.4k
  • 284
  • 149.6k

Serilog - how to send email to multiple recipients

Jun 5 2023 2:26 PM

Hello,

I am working on a background worker service and trying to send emails to **multiple **recipients with the configuration below. But unfortunately, It does not work. Is there a way to send email to multiple recipients? I searched google but couldn't find a way though.

{
  "Name": "CustomEmail",
  "Args": {
    "ConnectionInfo": {
      "NetworkCredentials": {
       
        "UserName": "[email protected]",
        "Password": "1234"
      },
      "FromEmail": "[email protected]",
      "MailServer": "smtp.gmail.com",
      "EmailSubject": "[{Level}] Multiple Requests",
      "Port": "465",
      "IsBodyHtml": false,
      "EnableSsl": true,
      "ToEmail": "[email protected]; [email protected]",
      "RestrictedToMinimumLevel": "Error",
      "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm} [{Level}] {Message}{NewLine}{Exception}"
    }

  }
}

Both of the usages below did not work.

"ToEmail": "[email protected]; [email protected]"
"ToEmail": "[email protected], [email protected]"

Answers (2)