Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Sir,
I am sending email form personal domain to some email id with embedded image(Company logo),
but there is a prblm the mail which m sending is going in spam folder of the receiver.
what is the prblm..how to send that mail in inbox not in spam folder.pls help

thanks in advance
this is my code..
C#
try
        {
            MailMessage Msg = new MailMessage();
            // Sender e-mail address.
            Msg.From = new MailAddress(txtUsername.Text);
            // Recipient e-mail address.
            Msg.To.Add(txtTo.Text);
            Msg.Subject = txtSubject.Text;
            // File Upload path
            //String FileName = fileUpload1.PostedFile.FileName;
            string path = Server.MapPath("~/images/byohbaraat logo.png");
            string mailbody = txtBody.Text + "<br /><img src=cid:companylogo>";
            LinkedResource myimage = new LinkedResource(path);
            // Create HTML view
            AlternateView htmlMail = AlternateView.CreateAlternateViewFromString(mailbody, null, "text/html");
            // Set ContentId property. Value of ContentId property must be the same as
            // the src attribute of image tag in email body. 
            myimage.ContentId = "companylogo";
            htmlMail.LinkedResources.Add(myimage);
            Msg.AlternateViews.Add(htmlMail);
            // your remote SMTP server IP.
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "mail.byohbaraat.com";
            smtp.Port = 587;
            smtp.Credentials = new System.Net.NetworkCredential(txtUsername.Text, txtpwd.Text);
            smtp.EnableSsl = false;
            smtp.Send(Msg);
            Msg = null;
            Response.Write("Mail Sent Succesfully");
        }
        catch (Exception ex)
        {
            Console.WriteLine("{0} Exception caught.", ex);
        }
Posted
Updated 1-Mar-13 20:50pm
v3

1 solution

You must be sending the advertising emails and some of the receivers
must have reported your email domain as spam . So it goes to the spam folders.

The only solution is to instruct the users to check the spam folders and add the domain to safe senders list . for example -the 'not spam' button in GMail. If the user adds your domain to their safe senders list, then all the future emails will be delivered to the inbox and not the spam
 
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