I have created an ASP.NET Web application using razor pages (not controllers) and this uses the Individual accounts from Identity.
The whole purpose of my site is that an admin logs in and uploads a document, they then press a button that sends an email to the receipting user to say they have a document to view.
I was wondering with microsoft identity, is there a possibility to use multiple emails? For example, putting a semi-colon between emails so that when the email is sent, it goes to multiple people.
The code im using behind the button to send the email is as follows:
using (var smtp = new System.Net.Mail.SmtpClient("ip address here"))
{
var emailMessage = new MailMessage();
emailMessage.From = new MailAddress("[email protected]");
emailMessage.To.Add(email);
emailMessage.Subject = "New Document Avaialable!";
emailMessage.Body = "You have a new purchase order available to view on the Portal!";
await smtp.SendMailAsync(emailMessage);
}
CodePudding user response:
Fix as follows:
In the register.cshtml, there is an InputModel class that looks something along the lines of:
public class InputModel
{
[Required]
[DataType(DataType.Text)]
[Display(Name = "User Name")]
public string UserName { get; set; }
[Required]
[EmailAddress]
[Display(Name = "Email")]
public string Email { get; set; }
}
First of all, I removed the [EmailAddress] from above the email.
Then instead of a semi-colon in the email text box, i put a comma between each email address and it worked.