This is a set of references to PDF libraries you can use:
http://csharp-source.net/open-source/pdf-libraries.
This is probably the most used library:
iTextSharp, a .NET PDF library | SourceForge.net[
^].
Now, about mail "attachment". This is a very confusing work. In fact, nothing is "attached". E-mail is a pure-text block of data with optional "parts". Each part can have it's own
content type and
content disposition. Please see:
MailMessage Class (System.Net.Mail)[
^],
MailMessage.Attachments Property (System.Net.Mail)[
^],
AttachmentBase.ContentType Property (System.Net.Mail)[
^],
Attachment.ContentDisposition Property (System.Net.Mail)[
^],
ContentDisposition Class (System.Net.Mime)[
^].
Content types are maintained and standardized by IANA, here:
Media Types,
Media Types (
Text).
As you can see, you need "application/pdf". The data for this content (as with most other cases), should be represented in base64 form (
Base64 - Wikipedia, the free encyclopedia[
^]). As to
ContentDisposition
, it shows the mail message viewer how to display the part. It can be rendered in the single flow with main content of offer downloading, hence you have these options:
DispositionTypeNames.Inline Field (System.Net.Mime)[
^],
DispositionTypeNames.Attachment Field (System.Net.Mime)[
^].
With PDF, you certainly need the last name value for
ContextDisposition
,
System.Net.Mime.DispositionTypeNames.Attachment
.
Finally, sending mail. In .NET FCL, SMTP is supported:
SmtpClient Class (System.Net.Mail)[
^].
For other client protocols, you can easily find 3rd-party solutions, but SMTP is usually enough.
—SA