Attachments
Image Embedding
Base64 Data URI
email.EnableImageEmbedding(timeout: 30, optimize: false);CID Inline Attachments
email.EnableInlineImageAttachments(timeout: 30);Image Optimization
email.ConfigureImageOptimization(maxWidth: 800, maxHeight: 600, quality: 85);ICS Calendar
Generate iCalendar (.ics) attachments:
var calendar = new EmailIcsCalendar();
calendar.WithMethod(EmailIcsMethod.Request)
.WithFileName("team-meeting.ics")
.AddEvent(new EmailIcsEvent()
.WithSummary("Team Meeting")
.WithDescription("Weekly team sync")
.WithLocation("Conference Room A")
.WithWhen(
new DateTimeOffset(2026, 2, 15, 10, 0, 0, TimeSpan.Zero),
new DateTimeOffset(2026, 2, 15, 11, 0, 0, TimeSpan.Zero)));
var calendarBytes = calendar.ToBytes();
var calendarFileName = calendar.FileName;
var calendarContentType = calendar.ContentType;VCard
Generate vCard (.vcf) contact attachments:
var vcard = new EmailVCard();
vcard.WithName("John", "Doe")
.WithFileName("john-doe.vcf")
.AddEmail("john@example.com", EmailVCardEmailType.Work, preferred: true)
.AddPhone("+1-555-0123", EmailVCardPhoneType.Cell, preferred: true)
.WithOrganization("Acme Corp")
.WithTitle("Customer Success");
var vcardBytes = vcard.ToBytes();
var vcardFileName = vcard.FileName;
var vcardContentType = vcard.ContentType;Using Attachments
Inline image resources are included in the render result:
var result = await email.RenderAsync();
// result.Html contains the rendered email HTML
// result.InlineResources contains CID attachments for embedded imagesCalendar and vCard payloads are exported separately, then attached with your mail library using the suggested FileName , ContentType , and ToBytes() values shown above.
API Reference
- Calendar API: /api/email/htmlforgex-email-emailicscalendar/
- vCard API: /api/email/htmlforgex-email-emailvcard/
- Render result API: /api/email/htmlforgex-email-emailrenderresult/
- Inline resource API: /api/email/htmlforgex-email-emailinlineresource/