/ <summary>
/ Sends the mail to gmail through STunnel
/ </summary>



string fullPath)
        {
if (Settings.FullDirectoryPathInSubject)
            {
                filename = fullPath;
            }
false;
new MailAddress(Settings.EmailTo);
new MailAddress(Settings.EmailFrom);
new MailMessage(fromAddress, toAddress);
, Settings.EmailFilter, filename); ;
            mail.Body = filename;
new Attachment(fullPath);
            mail.Attachments.Add(attachment);
new SmtpClient(Settings.SmtpServer, Settings.SmtpPort);
SendAsync(mail, fileInfo);
while (!mailSent)
            {
500);
            }
            mail.Dispose();
        }
 
 
/ <summary>
/ This is called once the email is sent successfully
/ </summary>


object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
 Get the unique identifier for this asynchronous operation.
            FileInfo fileInfo = (FileInfo)e.UserState;
string filename = Path.GetFileName(fileInfo.FullName);
, filename);
null)
            {
, fileInfo.FullName, e.Error.ToString());
            }
true;
        }

相关文章: