Adding attachment to mobile email application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • E11esar
    New Member
    • Nov 2008
    • 132

    Adding attachment to mobile email application

    Hi there.

    I am developing a mobile device application which has an OpenFileDialog control which copies an image into a PictureBox, code as follows:

    Code:
    try
    
    {
    
    OpenFileDialog open = new OpenFileDialog(); 
    open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
    
    if (open.ShowDialog() == DialogResult.OK) 
    {
    
    pbImage.Image = new Bitmap(open.FileName);pbImage.SizeMode = PictureBoxSizeMode.CenterImage; 
    }
    
    }
    
    catch (Exception) 
    {
    
    throw new ApplicationException("Failed loading image"); 
    }
    That all works fine but what I also want to do is to email this image as an attachment of an email. This email functionality is within another Button click event as other fields in the mobile device form are included in the email as text.

    Can anybody suggest some way(s) I can use to capture this image as an attachment, as well as displaying it in a picture box please?

    Thank you.

    M :o)
  • E11esar
    New Member
    • Nov 2008
    • 132

    #2
    Solution

    I was able to solve this one. Simply a case of setting a string variable to ve equal to the open.FileName value in the code above, then instantiating a new Attachment and passing this the respective string value in the constructor.

    All done.

    Thank you.

    Mark :o)

    Comment

    Working...