Comments (10)
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.
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.
Ah I didn't think to try that, I'll give it a shot. The attachment is a VCF file.
from postal.
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.
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.
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.
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.
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.
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.
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)
- Add support on other html attributes except alt in @Html.EmbedImage() HOT 2
- How to add external link with params? HOT 2
- Is this project still being supported? HOT 3
- How to identify if the email is sent or not HOT 4
- Html Helpers not working from console application HOT 4
- Postal MVC5 project references MVC 5.1.0.0 instead of 5.1.2 as the requirements state HOT 7
- Postal w/o MVC NuGet package?
- How to provide smtp settings runtime(not in web or app config)
- With Framework 4.6.2 it give error Attempted to access an element as a type incompatible with the array HOT 6
- Previewing emails with addresses with names HOT 4
- Install-Package : Input string was not in a correct format. HOT 6
- Continuation of Postal HOT 26
- enable sasl authentification HOT 7
- System.ArgumentNullException with .NET 4.5.2 WebApi HOT 9
- Sample For Postal.AspnetCore? HOT 3
- The parameter 'addresses' cannot be an empty string. HOT 1
- Layouts Stopped Working
- MVC4 throws exception when using autofac and MVC async controller actions HOT 3
- How to use Postal with Unity IoC Container MVC 5?
- Subject encoding HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postal.