Hi Am getting this error: while sending to all the emails in from db:
The specified string is not in the form required for an e-mail address...
What I saw is due to a missing of a comma.
Because while testing by sending using this query, it is working:
ALTER PROCEDURE [dbo].[GetUserByEmail]
AS
BEGIN
SELECT U.UserName as Email from [User] U
left join [Member] M on M.UserId=U.UserId
where U.UserId in(9, 52, 51)
END
But when I am removing this line of code
where U.UserId in(9, 52, 51)
it is not working: means like this
ALTER PROCEDURE [dbo].[GetUserByEmail]
AS
BEGIN
SELECT U.UserName as Email from [User] U
left join [Member] M on M.UserId=U.UserId
I am getting that error mentioned above.
And this is my c# code:
string[] recipients = new[] { "teke@gmail.com", "dan.jojo@gmail.com" };
DataTable dt = _UserInfo.GetUserAllByEmail();
string recipient;
mailMessage.From = new MailAddress("sales@gmail.com", "We have big Deals for you!");
mailMessage.To.Add("dan@gmail.com");
foreach (DataRow drRecipient in dt.Rows)
{
mailMessage.Bcc.Add(drRecipient["Email"].ToString());
mailMessage.Bcc.Add(",");
}
mailMessage.Subject = "Test Email";
mailMessage.IsBodyHtml = true;
as u can see on from this code , I am trying to seperate the email like this:
mailMessage.Bcc.Add(",");
But it is not working, I am still getting that error.
How can I separate the email with the comma?