Click here to Skip to main content
15,887,924 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
using c#, i have created a class to save emails messages to a pickup directory to local host.
now, i wanted to ask is it possible to use IIS (internet information services )for sending the saved messages? i ma using windows 8.

if u know any SMTP relay for sending emails, please share it. thank you!


the following code is sending the emails correctly when the attachment size is lower than 10 MB, so i wanted to change and save the messages to pickup folder then using IIS for sending emails or any using any SMTP SERVER or relay ..
thank you for help!


C#
// send the email in a new thread..
 private void SynchonEmilSender_DoWork(object sender, DoWorkEventArgs e)
 {
     bool isSent = true;
     try
     {

         _uiMailMainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate()
         {
             sendEmailNotation.Mid = composeMessageTextBox.Mid;
             sendEmailNotation.lbl_notation_text.Foreground = Brushes.Black;
             // add once Only.
             if (!isFound())
             {
                 _uiMailMainWindow.stack_send_email_noations.Children.Add(sendEmailNotation);
             }
             composeMessageTextBox.Visibility = Visibility.Collapsed;
             if (composeMessageTextBox.MyTap != null)
             { composeMessageTextBox.MyTap.IsEnabled = false; }


             if (composeMessageTextBox.IsForwardMessage)
             {
                 string str = composeMessageTextBox.mailMessage.Subject;
                 composeMessageTextBox.mailMessage.Subject = "FW:" + str;
                 composeMessageTextBox.btn_send.IsEnabled = false;

             }
             if (composeMessageTextBox.IsReplyMessage)
             {
                 string str = composeMessageTextBox.mailMessage.Subject;
                 composeMessageTextBox.mailMessage.Subject = "RE:" + str;
                 composeMessageTextBox.btn_send.IsEnabled = false;
             }


         });

         SmtpClient SmtpclientSide = new SmtpClient("smtp.live.com", 587);
         SmtpclientSide.UseDefaultCredentials = true;
         SmtpclientSide.DeliveryMethod = SmtpDeliveryMethod.Network;
         //SmtpclientSide.PickupDirectoryLocation = Directory.GetCurrentDirectory();
         SmtpclientSide.Credentials = new System.Net.NetworkCredential(Ulogin.EmailAddress,Ulogin.EmailPassword);
         SmtpclientSide.EnableSsl =true;

         // add FW: and RE:
        composeMessageTextBox.mailMessage.Priority = MailPriority.High;
        SmtpclientSide.Send(composeMessageTextBox.mailMessage);

     }
     catch(SmtpException exp)
     {
         isSent = false;
         MessageBox.Show(exp.StatusCode.ToString());
     }
     finally
     {
         if (isSent) { SynchonEmilSender.ReportProgress(100); }
         else { SynchonEmilSender.ReportProgress(0); }
     }
 }
Posted

1 solution

In order to send emails to people outside your network successfully it needs to come from a registered email server. This one seems relatively inexpensive. http://www.jangosmtp.com/
 
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