Giter Site home page Giter Site logo

Comments (10)

dsghi avatar dsghi commented on September 25, 2024

It's definitely something to do with formatting the attachment I think. If I send the attachment to my desktop email, then manually download it, compose a new message in outlook, attach the file, and then send it to my ipad, I receive the attachement as expected.

from postal.

andrewdavey avatar andrewdavey commented on September 25, 2024

What type of file are you attaching?

If you send an email using the .NET SmtpClient and MailMessage classes (which Postal uses itself) do you get a correct email? I need to know if this is a .NET issue or something specific that Postal is doing wrong.

from postal.

dsghi avatar dsghi commented on September 25, 2024

Ah I didn't think to try that, I'll give it a shot. The attachment is a VCF file.

from postal.

dsghi avatar dsghi commented on September 25, 2024

OK, so it does work using SmtpClient if I attach the file without specifying the content type, such as: message.Attachments.Add(new Attachment("C:\file.vcf")); that gives it a Content-Type: application/octet-stream.

I looked on the email I'm generating with postal and I'm ending up with a Content-Type of text/x-vcard, which is technically correct, but obviously a problem for apple email lol. I'm not sure where that's getting set, is that being set by Postal? I'm attaching in postal using a memory stream, and only passing in the name: Attachments.Add(vcfName, memoryStream.ToArray());

from postal.

dsghi avatar dsghi commented on September 25, 2024

I wanted to make sure it wasn't something with my vcf library, so I've tried using the same code to generate the attachment with smtpclient, and the content-type remains application/octet-stream if I don't explicitly set it. So at this point, it's got to be something with postal. Is there any option for explicitly setting the content-type of an attachment in Postal? I'm looking through the source, but not seeing anything... Thanks for the help, btw :)

from postal.

andrewdavey avatar andrewdavey commented on September 25, 2024

Cassette doesn't really do any processing of attachments. It simply adds them to the generated MailMessage class. So I don't understand why you're getting different content types.

Can you try specifying the content type when creating the attachment:

email.Attach(new Attachment(stream, fileName, "application/octet-stream"));

Does this force the right content type?

from postal.

dsghi avatar dsghi commented on September 25, 2024

It's working fine, I'm just a moron, and didn't realize there was a difference in code between my production site where the issue was occuring and my dev enviroment, where it's working perfectly. So there's no problem with your code. Also for future reference, it is possible to set any arbitrary content type using the code you suggested. Thanks again for your help, sorry it turned out to be a mistake lol!

from postal.

andrewdavey avatar andrewdavey commented on September 25, 2024

No worries :) I'm glad you've solved it!

My guess about the differing environments is that either the Windows registry or IIS has a mapping of file extensions to content types. So your production server must have an entry for vcf files.

from postal.

dsghi avatar dsghi commented on September 25, 2024

You haven't by chance tried working with this in .net 4.5 or MVC 4 yet have you? I've been playing with the developer preview and I'm really excited for the mobile view support. The only reason I'm asking, is I loaded postal and I'm getting an unimplemented exception when I try to send. I can't tell if it's something just not yet complete in .net 4.5 or something no longer availible.

from postal.

andrewdavey avatar andrewdavey commented on September 25, 2024

I've not tried .NET 4.5 yet. Can you paste in the stack trace into a new GitHub issue please? I'm guessing it's one of the System.Web.Http*Base classes, which Postal overrides, missing something used by 4.5.
Thanks.

from postal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.