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]"
Rajkiran SwainPosted Jun 5, 2023, 4:00 PM
Hello,
To send emails to multiple recipients using Serilog, you can separate the email addresses with commas (",") instead of semicolons (";"). The correct configuration for sending emails to multiple recipients would be:
"ToEmail": "[email protected], [email protected]"
Ensure that there are no spaces between the email addresses and the commas. With this configuration, Serilog should be able to send emails to both recipients.
If you're still experiencing issues with sending emails to multiple recipients, please provide more details about any error messages or unexpected behavior you're encountering, and I'll be happy to assist you further.
Mohamed Azarudeen ZPosted Jun 5, 2023, 2:55 PM
Hi RAY
you can modify your configuration to send emails to multiple recipients:
By using square brackets
[ ], you can specify multiple email addresses as separate elements within the array.Update your configuration with the modified syntax shown above, and it should work correctly for sending emails to multiple recipients.