1

I'm trying to send a PDF file for a Kindle device.

If I send that file using my GMAIL account (sending via web browser) the file is sent properly (I can see that file under the Amazon > Manage Your Kindle section)

My SmtpClient configuration code is fine - any emails under my project are being sent properly.

Only sending a file as an email attachment is not working, I don't see that file in the Amazon > Manage Your Kindle section. The code below doesn't throw any exceptions or errors, the message is sent.

var smtp = new SmtpClient()
        {
            Host = "SMTP_SERVER",
            Port = "SMTP_PORT",
            EnableSsl = true,
            DeliveryMethod = SmtpDeliveryMethod.Network,
            UseDefaultCredentials = false,
            Credentials = new NetworkCredential("login", "pass")
        };

var msg = new MailMessage(new MailAddress("my_email", "my_name"),
                          new MailAddress("some_name@kindle.com"))
            {
                Subject = "Your Kindle file",
                IsBodyHtml = true
            };

            Attachment data = new Attachment(PDF_file_path,
                                             MediaTypeNames.Application.Pdf);
            msg.Attachments.Add(data);

            smtp.Send(msg);

Any ideas ?

c0deNinja
  • 3,956
  • 1
  • 29
  • 45
Tony
  • 12,405
  • 36
  • 126
  • 226

2 Answers2

1

When you send it to another email, the attached file is present?

Did you debug the program just before the send command?

Is this ok when you're sending it from your email address?

Is there email firewall rules in the "Your Kindle approved e-mail list" menu, in the "Manage Your Kindle" settings?

I know that there is no restriction in Kindle t&c regarding file attachments. Amazon only asks for the file to be in a recognized ebook format.

iTextSharp - Sending in-memory pdf in an email attachment

http://www.eggheadcafe.com/community/csharp/2/10238481/attachment-file-is-missing.aspx

Community
  • 1
  • 1
Léon Pelletier
  • 2,701
  • 2
  • 40
  • 67
0

OK, I've figured it out - after I have to add my email address to the trusted emails list in the Amazon account (Personal Document Settings > Approved Personal Document E-mail List)

Then the mail had been delivered. Thanks guys !

Tony
  • 12,405
  • 36
  • 126
  • 226