Hi all my name is rama kishore
I am sending emails in asp.net by using one of my client domain abaoth2.com.
Now i want to store the emails what i was sent....please tell me how to do that one
please help me....

Dani AI

Generated

Short practical plan that builds on question and the replies from and : treat "storing sent mail" as an audit/outbox problem rather than an afterthought. Record structured metadata, the original MIME (or at least both HTML and text bodies), headers, attachments (or references to them), SMTP response and status. Use an outbox pattern (persist first, send from a background worker) to guarantee retries and avoid lost records when sending fails.

Suggested minimal schema to capture what you need:

CREATE TABLE SentEmails (
  Id UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
  MessageId NVARCHAR(255),
  FromAddress NVARCHAR(320),
  ToAddresses NVARCHAR(2000),
  CcAddresses NVARCHAR(2000),
  Subject NVARCHAR(1000),
  BodyHtml NVARCHAR(MAX),
  BodyText NVARCHAR(MAX),
  MimeBytes VARBINARY(MAX),
  SentAt DATETIMEOFFSET NULL,
  Status TINYINT,        -- 0 = queued, 1 = sent, 2 = failed
  SmtpResponse NVARCHAR(2000)
);

CREATE TABLE EmailAttachments (
  AttachmentId UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
  EmailId UNIQUEIDENTIFIER REFERENCES SentEmails(Id),
  FileName NVARCHAR(500),
  Content VARBINARY(MAX)
);

Example workflow (pseudo-C# using a modern mail library): build a MimeMessage, write it to a MemoryStream, save the bytes and metadata in SentEmails with Status=0, then let a background sender (Hangfire/WorkerService/queue) load queued rows, send via SMTP, update Status/SentAt/SmtpResponse. Storing the raw MIME (MimeBytes) makes later replay or display trivial.

Practical tips and cautions: store attachments in blob storage for large files and keep DB rows small; scan attachments for malware; encrypt sensitive fields at rest and limit access; avoid storing BCC if it violates privacy rules; keep SMTP server responses and Message-Id for troubleshooting and dedup. If you need copies in users' mailboxes, use the mail provider API (IMAP/Exchange/Graph) to append to Sent Items rather than trying to reconstruct it client-side.

Recommended Answers

All 2 Replies

You could always store the body of the email in a field in a database. Alternatively, you could use a 3rd party mail sender that saves a copy of sent messages. We use Persits ASPEmail. It is nice because it provides logging of failed messages and provides queue functionality.

you can save the Body and relavent information to database .

after you can retrieve that information whenver u need.

wherever you wanted to present.

You could always store the body of the email in a field in a database. Alternatively, you could use a 3rd party mail sender that saves a copy of sent messages. We use Persits ASPEmail. It is nice because it provides logging of failed messages and provides queue functionality.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.