Closed ugookoro closed 8 years ago
I've fixed this.
The error is get is "an invalid character was found in the mail header ','
i fixed this by removing the trailing comma at the end or my recipients
string (Basically the recipients
variable was returning "example@email.com, email@email.com," so i removed it by calling the String.TrimEnd([offending char here])
.
Hi. I'm trying to send emails to multiple recipients in my code. The email addresses of these recipients are saved in a
List<string>
object which is saved in the model that my email view uses. the problem is it always breaks. here's my implementation `@using Entities.Models.Mailer; @using System.Web.Mvc; @model SharerInterestNotificationEmail @{ var recipients =""; foreach (var item in Model.Recipients) // Model.Recipients is a list of email addresses. { recipients += item + " "; }}
To: @recipients From: @Model.Sender Subject: Interest Content-Type: text/html; charset=utf-8
html here
` The error is get is "an invalid character was found in the mail header ' ,'" is there a way to send emails to multiple recipients without using the CC or BCC headers.