Skip to content

Email sending functionality not working on Production server

chetan chandan

Asked Aug 12, 2014, 10:18 PM EDT2 answers
Share
LinkedInX
Hi,
 
In my application(built using Asp.Net) i am facing an issue while sending emails and this issue comes up only on the Production server, locally on my machine the same functionality works fine like i can send and receive emails, the situation is there is no error i can see in the system on Production server.
I am using smtp configuration to send emails with port no. 25.
 
Any kind of inputs or help will be appreciated.
 
Thanks in advance. 

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • jitendra mane
    0
    hey cool try this code..




    C#
     public static bool SendMailWithBCC(string from, string strToCsvEmail, string subject, string message, string strCSVBCCEmail, string attachDocumentPath)
            {
                try
                {
                    MailMessage mailMessage = new MailMessage(new MailAddress(from), new MailAddress(strToCsvEmail));
    
                    int Port = 25;
                    mailMessage.Subject = subject;
                    mailMessage.IsBodyHtml = true;
                    mailMessage.Body = message;
    
    
    
                    System.Net.NetworkCredential networkCredentials = new System.Net.NetworkCredential("{Enter mail here}", "{Password}");
                    SmtpClient smtpClient = new SmtpClient();
    
    
                    smtpClient.EnableSsl = true;
                    smtpClient.UseDefaultCredentials = false;
    
    
                    smtpClient.Credentials = networkCredentials;
                    //smtpClient.Host = "smtp.gmail.com";
                    smtpClient.Host = "smtp-mail.outlook.com";
                    smtpClient.Port = Port;
                    smtpClient.Send(mailMessage);
                    return true;
                }
                catch (Exception ex)
                {
                    ex.ToString();
                    return false;
                }
            }
    0
  • 0
    Hi,

    Thanks a ton for your reply, but the thing is the functionality what i have written is working fine on my machine, but it doesn't work on the client's machine, if you have come across this kind of situation please give me your inputs.

    Others are also requested to share their views.

    Thanks.
    0