title: opennetcf.net.mail attachment help
body: <p>Thanks for looking at my question. </p>
  
  <p>I am trying to figure out attachments for OpenNetCF.Net.Mail.  Here is the code for my SendMail function:</p>
  
  <pre><code>public static void SendMessage(string subject, 
    string messageBody, 
    string fromAddress, 
    string toAddress, 
    string ccAddress)
  {
      MailMessage message = new MailMessage();
      SmtpClient client = new SmtpClient();
  
      MailAddress address = new MailAddress(fromAddress);
  
      // Set the sender's address
      message.From = address;
  
      // Allow multiple "To" addresses to be separated by a semi-colon
      if (toAddress.Trim().Length &gt; 0)
      {
          foreach (string addr in toAddress.Split(';'))
          {
              message.To.Add(new MailAddress(addr));
          }
      }
  
      // Allow multiple "Cc" addresses to be separated by a semi-colon
      if (ccAddress.Trim().Length &gt; 0)
      {
          foreach (string addr in ccAddress.Split(';'))
          {
              message.CC.Add(new MailAddress(addr));
          }
      }
  
      // Set the subject and message body text
      message.Subject = subject;
      message.Body = messageBody;
  
      // TODO: *** Modify for your SMTP server ***
      // Set the SMTP server to be used to send the message
      client.Host = "smtp.dscarwash.com";
      string domain = "dscarwash.com";
      client.Credentials = new SmtpCredential("mailuser", "dscarwash10", domain);
  
      // Send the e-mail message 
      try
      {
          client.Send(message);
      }
      catch (Exception e)
      {
          string data = e.ToString();
      }
  }
  </code></pre>
  
  <p>It is supposed to be a matter of tweaking it in the following way to allow attachments:</p>
  
  <pre><code>Attachment myAttachment = new Attachment();
  message.Attachments.Add(myAttachment);
  </code></pre>
  
  <p>The problem is that I cannot figure out how to get the attachment to add.  The lines above should be it with something else in the middle where I actually tell it what file I would like to attach.  Any help on this matter will be greatly appreciated.</p>
  
  <p>Thanks again!</p>