I think we can create a text image and convert it to jpeg file by doing some code like this but how to embed this image with mail and send.any help is appreciated
string Text = HttpContext.Current.Request.QueryString["Text"];
Color FontColor = Color.Blue;
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 10;
int Height = 150;
int Width = 150;
Bitmap bitmap = new Bitmap(Width, Height);
Graphics graphics = Graphics.FromImage(bitmap);
Color color = Color.Gray;
System.Drawing.Font font = new System.Drawing.Font(FontName, FontSize);
PointF point = new PointF(5.0F, 5.0F);
SolidBrush BrushForeColor = new SolidBrush(FontColor);
SolidBrush BrushBackColor = new SolidBrush(BackColor);
Pen BorderPen = new Pen(color);
System.Drawing.Rectangle displayRectangle = new System.Drawing.Rectangle(new Point(0, 0), new Size(Width - 1, Height - 1));
graphics.FillRectangle(BrushBackColor, displayRectangle);
graphics.DrawRectangle(BorderPen, displayRectangle);
StringFormat format1 = new StringFormat(StringFormatFlags.NoClip);
StringFormat format2 = new StringFormat(format1);
graphics.DrawString(Text, font, Brushes.Red, (RectangleF)displayRectangle, format2);
HttpContext.Current.Response.ContentType = "image/jpeg";
bitmap.Save(HttpContext.Current.Response.OutputStream, ImageFormat.Jpeg);
The code sample below skips creating the message and adding the subject, body and addresses. It shows the code used to embed an image that is initially stored in a byte array. The key is to get your image into a memory stream.
I had issues where the embedded image was shown in some email programs, and not others. I modified the line that creates the linked resource, and the line that creates the new AlternativeView and the image is now viewable across a wider range of programs.