Click here to Skip to main content
15,887,485 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: Problem with Knockout mapping of observable array. Pin
AumSingh18-May-12 20:07
professionalAumSingh18-May-12 20:07 
Questionhow can i bind data from excel file? Pin
heinhtataung16-May-12 23:09
heinhtataung16-May-12 23:09 
AnswerRe: how can i bind data from excel file? Pin
frostcox19-May-12 21:36
frostcox19-May-12 21:36 
AnswerRe: how can i bind data from excel file? Pin
frostcox25-May-12 11:08
frostcox25-May-12 11:08 
QuestionUse of Session states in SharePoint 2010 Pin
Athar Raza Faridi16-May-12 20:37
Athar Raza Faridi16-May-12 20:37 
QuestionMessage box with 3 buttons Yes/NO/Cancel in ASP.Net Pin
berba16-May-12 3:15
berba16-May-12 3:15 
AnswerRe: Message box with 3 buttons Yes/NO/Cancel in ASP.Net Pin
Sandeep Mewara16-May-12 7:38
mveSandeep Mewara16-May-12 7:38 
QuestionEmails Sent by Window Service/C# Code are landing in spam in Gmail Pin
masterprogrammertech14-May-12 1:19
masterprogrammertech14-May-12 1:19 
Hi
We have a dynamic website where we are sending emails to users (like reminder emails like linkedin or facebook does. For example , if user has not verified his email id, then we send them verification emails ) . Now these emails are successfully delivered to users who are using hotmail, yahoo and Outlook but it is going in spam in case of Gmail. I am not sure why it is going in spam.
We are like sending 5 emails in 1 second and currently using our own IP . Our ip is not in blacklisted list anywhere . And also as I am saying its going well in all other email clients except gmail.
We would like to send emails by Amazon SES but the ip which they had provided us was blacklisted and some of the emails were not delivered. So we turned off that thing until we get a clean IP and started using ours.
Our website is live and we would like to know the solution asap. Also , sometimes the email goes well in gmail if we are sending 1 email at a time after longer duration but when we are sending these reminder emails , then its going into SPAM.
Please help.
I have attached the file where we are calling sendemails function which infact is send function to send emails. There are 2 send email function , one is for sending through amazon SES and other is through normal asp.net email function. Do you also want the text which we are sending? It is long text with 3-4 click here outbound links but professional and corporate text.
I am looking for help asap.
C#
private void SendEmails(string UserEmail, string from, string subject, string mail_content)
    {
        TimeSpan timeSpanForDelay = new TimeSpan(0, 0, 0, 0, 200);//To send 5 Emails in 1 Second.
        System.Threading.Thread.Sleep(timeSpanForDelay);
        Send(UserEmail, from, subject, mail_content);
    }


public void Send(string MessageTo_EmailID, string MessageFrom_EmailID, string Subject, string MailBody)
    {
        try
        {
            string head = string.Empty;
            string foot = string.Empty;
            MessageFrom_EmailID = WebConfigurationManager.AppSettings["FromEmail"].ToString();
            bool sendEmailFromAmazone = false;

            try
            {
                PostBuyerOffer objbuyer = new PostBuyerOffer();
                DataTable dtParam = objbuyer.FungetParameterDetail("Email Function for Sending Email");
                if (dtParam.Rows.Count > 0)
                {
                    if (dtParam.Rows[0]["Pvalue"].ToString().ToLower() == "amazon ses")
                        sendEmailFromAmazone = true;
                }
            }
            catch { }

            DataTable dt = new DataTable();
            if (HttpContext.Current.Session["AdminRecords"] == null)
            {
                dt = objMem.GetAdminDetails();
                HttpContext.Current.Session["AdminRecords"] = dt;
            }
            else
                dt = (DataTable)HttpContext.Current.Session["AdminRecords"];

            if (dt.Rows.Count > 0)
            {
                if (sendEmailFromAmazone)
                {//Premium Email from Amazone Email SERVER.
                    try
                    {
                        string smtpServer = dt.Rows[0]["awsMailServer"].ToString();
                        string userName = dt.Rows[0]["awsAccessKey"].ToString(); 
                        string password = dt.Rows[0]["awsSecretAccessKey"].ToString(); 
                        List listColl = new List();
                        listColl.Add(MessageTo_EmailID);

                        SendEmailRequest mailObj = new SendEmailRequest();
                        Destination destinationObj = new Destination(listColl);
                        mailObj.Source = MessageFrom_EmailID;
                        mailObj.ReturnPath = MessageFrom_EmailID;
                        mailObj.Destination = destinationObj;

                        Amazon.SimpleEmail.Model.Content emailSubjectObj = new Amazon.SimpleEmail.Model.Content(Subject);
                        Amazon.SimpleEmail.Model.Content emailBodyContentObj = new Amazon.SimpleEmail.Model.Content(MailBody);

                        Amazon.SimpleEmail.Model.Body emailBodyObj = new Body();
                        emailBodyObj.Html = emailBodyContentObj;
                        
                        Message emailMessageObj = new Message(emailSubjectObj, emailBodyObj);
                        mailObj.Message = emailMessageObj;


                        AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
                        amConfig.UseSecureStringForAwsSecretKey = false;
                        amConfig.SignatureMethod = Amazon.Runtime.SigningAlgorithm.HmacSHA256;


                        // Set AWS access credentials            
                        Amazon.SimpleEmail.AmazonSimpleEmailServiceClient client = new Amazon.SimpleEmail.AmazonSimpleEmailServiceClient(userName, password, amConfig);
                        SendEmailResponse response = client.SendEmail(mailObj);
                        SendEmailResult result = response.SendEmailResult;
                        string s = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        //  Trace.Warn(ex.Message);
                    }
                }
                else
                {//Basic Email from ASP.NET SMTP SERVER.
                    string smtpServer = dt.Rows[0]["SMTPServer"].ToString();
                    string userName = dt.Rows[0]["SMTPUser"].ToString();
                    string password = dt.Rows[0]["SMTPPwd"].ToString();
                    int cdoBasic = 1;
                    int cdoSendUsingPort = Convert.ToInt32(WebConfigurationManager.AppSettings["Port"]);
                    string mailBody = MailBody;
                    byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(head + mailBody + foot);
                    mailBody = System.Text.ASCIIEncoding.ASCII.GetString(b);
                    SmtpClient emailClient;
                    NetworkCredential SMTPUserInfo;
                    MailMessage msg = new MailMessage(MessageFrom_EmailID, MessageTo_EmailID, Subject, mailBody);
                    msg.Body = mailBody;
                    msg.Priority = MailPriority.Normal;

                    msg.IsBodyHtml = true;
                    if (userName != "" && password != "")
                    {
                        emailClient = new SmtpClient(smtpServer);
                        emailClient.Port = cdoSendUsingPort;
                        SMTPUserInfo = new NetworkCredential(userName, password);
                        emailClient.UseDefaultCredentials = false;
                        emailClient.Credentials = SMTPUserInfo;
                    }
                    else
                    {
                        emailClient = new SmtpClient(smtpServer);
                        emailClient.Port = cdoSendUsingPort;
                        emailClient.UseDefaultCredentials = false;
                    }
                    try
                    {
                        emailClient.Send(msg);
                    }
                    catch (Exception ex)
                    {
                        //  Trace.Warn(ex.Message);
                    }
                }
            }
            HttpContext.Current.Session.Remove("AdminRecords");
        }
        catch { }
    }

AnswerRe: Emails Sent by Window Service/C# Code are landing in spam in Gmail Pin
Bernhard Hiller14-May-12 21:36
Bernhard Hiller14-May-12 21:36 
QuestionSubpages are not found. Pin
m_kukulka10-May-12 3:03
m_kukulka10-May-12 3:03 
AnswerRe: Subpages are not found. Pin
Bernhard Hiller10-May-12 4:25
Bernhard Hiller10-May-12 4:25 
QuestionWeb Crawling / Searching Pin
eddieangel9-May-12 6:08
eddieangel9-May-12 6:08 
AnswerRe: Web Crawling / Searching Pin
Bernhard Hiller9-May-12 21:20
Bernhard Hiller9-May-12 21:20 
QuestionFormat Date According to Regional Settings Pin
berba9-May-12 3:22
berba9-May-12 3:22 
AnswerRe: Format Date According to Regional Settings Pin
Richard MacCutchan9-May-12 4:31
mveRichard MacCutchan9-May-12 4:31 
AnswerRe: Format Date According to Regional Settings Pin
David Mujica9-May-12 4:35
David Mujica9-May-12 4:35 
GeneralHow to write code for Admin approve ! Pin
heinhtataung8-May-12 18:26
heinhtataung8-May-12 18:26 
GeneralRe: How to write code for Admin approve ! Pin
David Mujica9-May-12 4:30
David Mujica9-May-12 4:30 
GeneralRe: How to write code for Admin approve ! Pin
heinhtataung10-May-12 21:00
heinhtataung10-May-12 21:00 
QuestionGenetic algorithm for class schedule with PHP Pin
Luki Dwiyanto7-May-12 19:14
Luki Dwiyanto7-May-12 19:14 
QuestionNew Drupal Based Website - Feedback Please Pin
sagedread6-May-12 17:45
sagedread6-May-12 17:45 
AnswerRe: New Drupal Based Website - Feedback Please Pin
JohnPayton7-May-12 19:27
JohnPayton7-May-12 19:27 
GeneralRe: New Drupal Based Website - Feedback Please Pin
sagedread8-May-12 4:58
sagedread8-May-12 4:58 
GeneralRe: New Drupal Based Website - Feedback Please Pin
Richard MacCutchan8-May-12 5:14
mveRichard MacCutchan8-May-12 5:14 
GeneralRe: New Drupal Based Website - Feedback Please Pin
sagedread8-May-12 11:54
sagedread8-May-12 11:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.