in my asp.net website i want to check an emailid is existed id in any account ie:gmail,yahoo,any
in my site there is a problem to sent attachment in group mail if any id is not existed id
how to solve this problem
my code is
protected void btnSendGrp_Click(object sender, EventArgs e)
{
try
{
// string ToCopy = "";
int grpId = Convert.ToInt32(ddlGroup.SelectedValue);
MailRegistration obj=new MailRegistration();
DataSet dsgrp = obj.SelectGroupMemberformail(grpId);
int count=dsgrp.Tables[0].Rows.Count;
for (int i = 0; i <= count - 1; i++)
{
SmtpClient client = new SmtpClient();
MailMessage message = new MailMessage();
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/Admin/xml/feedbackmail.xml"));
string fromAddress = ds.Tables[0].Rows[0][0].ToString();
message.From = new MailAddress(fromAddress);
string ToAddress = dsgrp.Tables[0].Rows[i]["MailID"].ToString();
if (ToAddress != "")
{
message.To.Add(new MailAddress(ToAddress));// = address(ToAddress);
if (FuAttachment.PostedFile != null)
{
/* Get a reference to PostedFile object */
HttpPostedFile attFile = FuAttachment.PostedFile;
/* Get size of the file */
int attachFileLength = attFile.ContentLength;
/* Make sure the size of the file is > 0 */
if (attachFileLength > 0)
{
string fileName = Path.GetFileName(FuAttachment.PostedFile.FileName);
Attachment myAttachment =
new Attachment(FuAttachment.FileContent, fileName);
message.Attachments.Add(myAttachment);
}
}
message.Body = "Sender : " + fromAddress + "\n" + "\n" + "\n" + "Sub:" + txtsubject.Text + "\n" + "Message :" + txtmsg.Text;
client.Send(message);
}
}
CleaContents();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Al_Rawdha", "<script type='text/javascript'>alert('Your Message Has Been Send ');</script>", false);
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Al_Rawdha", "<script type='text/javascript'>alert('Message Send Failed');</script>", false);
}
}