• Advertisement
Sign in to follow this  

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

This topic is 3111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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);

            screenShotGraphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
                Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size,
                CopyPixelOperation.SourceCopy);

            screenShotGraphics.Dispose();

            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 = "mymail@domain.com";
            mail.To.Add("yourmail@domain.com");
            mail.Subject = "this is subject";
            mail.Body = "this is body";
            SmtpClient smtp = new SmtpClient("127.0.0.1");
            smtp.Send(mail);

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
Advertisement
Quote:
Original post by ernow
Attachment

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
Sign in to follow this  

  • Advertisement