Click here to Skip to main content
15,915,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);

}


}
Posted

1 solution

Email verification without sending a email is not 100% fool proof. However I would recommend some free webservices that suffice your purpose

http://wiki.cdyne.com/index.php/CSharp_Email_Verification[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900