Sign in to follow this  

[.net] C# winforms How to send bitmap object in mail

Recommended Posts

hey all, i want to take a screenshot and send it by mail.. i have this function to get screenshot
        public static Bitmap ScreenShot()
            Bitmap screenShotBMP = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
                Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);

            Graphics screenShotGraphics = Graphics.FromImage(screenShotBMP);

                Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size,


            return screenShotBMP;

so after that i have a bitmap object in my code Sweett.. now i want to send it by mail so i have this code to send mail

            MailMessage mail = new MailMessage();
            mail.From = "";
            mail.Subject = "this is subject";
            mail.Body = "this is body";
            SmtpClient smtp = new SmtpClient("");

how can i send the bitmap object by mail? by the way the mail works and i get send it... just how to add the picture when i take the screenshot i save it into the bitmap object i prefer not to save it into a file.. but if there is no other way to send it..

Share this post

Link to post
Share on other sites
Original post by ernow

Did you google?

offcruse i did and i was on the site u gave me already

it sais there that u need a filename

and i dont want to save the picture that i printscreened to put into a file..

and i didnt understand that so good to do so..

dont know why things look kinda strange...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this