1) store the report generation image locally.
Code
String Deviceinfo = " <Deviceinfo> <outputformat> PNG </outputformat> </deviceinfo> " ;
String Format = " Image " ;
Byte [] Bytes = Reportview1.serverreport. Render (format, deviceinfo, Out Mimetype, Out Encoding, Out Filenameextension, Out Streamids, Out Warnings );
Filestream FS = New Filestream ( " Hi.png " , Filemode. creat );
FS. Write (bytes, 0 , Bytes. Length );
FS. Close ();
2) Send the generated image as an inline attachment
Code
Email. Body = " <Div style = \ " Font - Family: Arial \ " > This is an inline attachment: <br/> " @ Image @@\ " Alt = \ " \ " > <Br/> thanks for downloading this example. </div> " ;
// Generate the contentid string using the datetime
String Contentid = Path. getfilename (attachmentpath). Replace ( " . " , "" ) + " @ Zofm " ;
// Create the inline attachment
String Attachmentpath = Environment. currentdirectory + @" \ Test.png " ;
Attachment inline = New Attachment (attachmentpath );
Inline. contentdisposition. inline = True ;
Inline. contentdisposition. dispositiontype = Dispositiontypenames. inline;
Inline. contentid = Contentid;
Inline. contenttype. mediatype = " Image/PNG " ;
Inline. contenttype. Name = Path. getfilename (attachmentpath );
Email. attachments. Add (Inline );
// Replace the tag with the correct content ID
Email. Body = Email. Body. Replace ( " @ Image @@ " , " CID: " + Contentid );
Smtpclient SMTP = New Smtpclient ( " Localhost " );
SMTP. Send (email );
Email. Dispose ();