468,505 Members | 1,675 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

Adding attachment to mobile email application

132 100+
Hi there.

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

Expand|Select|Wrap|Line Numbers
  1. try
  2.  
  3. {
  4.  
  5. OpenFileDialog open = new OpenFileDialog(); 
  6. open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
  7.  
  8. if (open.ShowDialog() == DialogResult.OK) 
  9. {
  10.  
  11. pbImage.Image = new Bitmap(open.FileName);pbImage.SizeMode = PictureBoxSizeMode.CenterImage; 
  12. }
  13.  
  14. }
  15.  
  16. catch (Exception) 
  17. {
  18.  
  19. throw new ApplicationException("Failed loading image"); 
  20. }
  21.  
  22.  
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)
Mar 30 '09 #1
1 3057
E11esar
132 100+
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)
Mar 31 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by knoak | last post: by
4 posts views Thread by DeeJay | last post: by
1 post views Thread by Bart Stes | last post: by
3 posts views Thread by Bart Stes | last post: by
7 posts views Thread by cj2 | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.