Link to home
Start Free TrialLog in
Avatar of vikalgupta
vikalguptaFlag for India

asked on

C# bulk mail

Hi,

We are facing problem while sending mail using third party SMTP relay. Error encountered as Operation time out and Failure sending mail. Error encountered unexpectedly and as discussed with vendor he is saying that there is some issue in application. But when we try to resend its working. below is the code snippet used:-

We have created a window service which is picking up the data from database and sending using the below code snippet
            try
            {
SmtpClient mailSender = new SmtpClient();
                mailSender.Host =’XXXX’;
                mailSender.Port = Convert.ToInt32(25);

                mailSender.Credentials = new System.Net.NetworkCredential(‘XXX’, ‘XXX’);
             
                mailSender.Send(object of mail message);            
                response.SUCCESSFLAG = true;
                response.RESPONSESTATUS = "SUCCESS";
                response.RESPONSEMESSAGE = "Successfully sent email";
               
            }
            catch(Exception ex)
            {
                response.SUCCESSFLAG = false;
                response.RESPONSESTATUS = "FAIL";
                response.RESPONSEMESSAGE = ex.Message ;          
            }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial