In my application i have to record a voice and send the recorded voice as an attachment to the client's server. I am using Transport.send(message) to send the email from within the application.
Now the problem that i am facing is that if the name of the recorded file is "abc.amr", it gets changed to something like "utf-8BdGVzdC5hbXI" on client server. The name gets garbled on client's server. However if I append ".amr" to the garbled file, it plays correctly. This is case not only with sound file but with any kind of file i attach (image, text etc.).
I also tried to send the mail separately using Blackberry email client, in that also the sme behaviour is seen. Can any suggest what should i add in my code to make it work correctly or any external changes.
It looks like the mail server is renaming the attachments. If you would like to send your file name correctly, how about adding it as a Subject or Body of the email
Related
I am trying to be able to send SMS messages with links that contain OpenGraph preview images which will load in the iOS "Messages" application and will display the thumbnail without the user having to press [Tap To Load Preview] first... How can this be achieved?
For this, I am sending a text SMS message to an iPhone X which is running iOS 10 and opened with the Messages app.
The text message body contains a URL that points to a resource (a HTML web page) whose body contains OpenGraph metadata with an og:image tag. Eg:
<meta property="og:image" content="https://www.apple.com/v/iphone/home/t/images/home/og.png?201610171354" />
For presentation purposes, we are trying to make it so that the image will load first and immediately, without the user having to tap the button in order to to see it...
Expected Behavior:
Actual Behavior:
As a side note, on the Android clients we have tested, where OpenGraph is supported the image will display instantly without the user being prompted to do anything. The same is true for any other OpenGraph supported application tested, including Facebook.
For reference, here are some of the methods I've tested to try to get this working for us (as well as combinations therein):
Tried serving the image directly with no intermediate redirects, also tried with redirects.
Tried serving PNG and JPG images.
Tried serving the images from URL's containing no more than 20 characters where the URL has the ".jpg" and ".png" parameters and no additional GET parameters. Also tried when the extensions aren't part of the link.
Tried serving the image from the server by referencing its IP directly instead of using a public domain name.
Tried with GET parameters as well, with random numbers to clarify a totally unique URL each time.
Tried serving the image from HTTPS and HTTP links.
Tried serving with dynamically generated images, which should entail a brief delay of some milliseconds while the image is rendered and served.
Tried an enforced sleep in the script that responds to the URL page as well as for the image request to induce an intentional delay of some milliseconds and experimented with various settings for that.
Tried serving the image with a variety of different dimensions, portrait and landscape as well as extremely large and extremely small and other variants between (50x50, 60x50, etc and up).
Always ensured that the image is <1 MB in size, but also tested larger images anyway to see if they would work.
Tried serving images from the same canonical source that the phone or Message service might already 'recognise' as 'trusted' as we have already loaded the preview from those those in the past (testing if such a feature exists, which it probably doesn't).
Tried specifically, all suggestions as noted Apple Technical Note "Best Practices for Link Previews in Messages" see https://developer.apple.com/library/content/technotes/tn2444/_index.html
Tried moving the OG tags outside of the <head> of the page.
Tried stripping of the page of all tags except for pertinent og:image tags.
Tried removing HTTP headers for the response to the GET to the image resource so that just the image itself is returned. Tried then adding back the Content-Type header alone.
Tried priming the request to the image to respond with various HTTP specification cache-invalidating related headers..
Tried sending from various phone numbers US and Australian, also tried changing the "From" field for the SMS message itself to strings like "VERIZON", "Verizon", "Telstra", "APPLE", "Apple", "Facebook", "Uber", "China".
Tried sending the messages from handheld phone as well as from the Twilio Messaging API service.
None of the above work for an iPhone X.
There is no way to do this with SMS. If you send it as an iMessage it will automatically display the preview.
On iPhones the preview is generated on the device rather than server-side. When a user taps preview their device sends 4 GET requests to the server. If the preview was generated automatically there would be a security vulnerability. You could send a text to any iPhone user and get their IP Address.
With iMessages the preview is generated automatically but there is no security vulnerability. The device sending the link sends 4 GET requests to the server, generates the preview and then transmits the preview to the recipient via iMessages. As a result, the receiving device has no need to send a request to the server to generate a preview. And their IP Address is not known to the owner of a webserver.
On Google's Android Messaging app the preview is generated server side. There is one GET request sent to the web server. But it originates from the Android Messages server. So again the owner of the webserver does not receive the recipient's IP Address from their receipt of the text.
I have a theoretical question to the file system/restriction from iOS.
In an Android app I can open a file from filesystem, with my app, and send it via mail or send it to a REST-service.
This is not possible under iOS, because there is no filesystem like under Android.
As far as I know I can only send file, which are created by my app.
Is there a way to send content from my app, which is not from my app?
For example a pdf received per mail, opened in my app and send it to a server or something else.
best regards
Yes, you can make your app eligible to open specific type of files ( images, videos, pdf, docs, etc )
see https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html
After that you bring the url file and you can work on it locally into your app, or uploading the linked file on a server as well
I have code that is generating an HTML file that is being sent via iMessage to another iPhone user. However, in the messages App on the receiving end, when they click on the HTML file, the formatting is super bare. (I know the HTML file works, because I forward it to a computer and it displays fine) There's none of the images displayed on the HTML file when viewed in the Messages App, and I have a Youtube video embedded that is not being displayed. My best guess is that the Messages app is stripping away all of this information... So how could I go about displaying my HTML file correctly? Could I somehow force it to open in Safari? I tried converting the HTML file to a PDF with no luck. Thanks.
Edit
Not possible. iMessage sends text messages as SMS, images or videos as MMS, which may incur extra cost to your user if they are not on WIFI. Never seen a HTML being sent with image and video before.
You can send the HTML file via email. And if you provide a link in your email, the Mail app will open it in Safari automatically.
There are many answers on sending mail from iPhone apps: one here
How can I programmatically send an e-mail that is encrypted and signed using S/MIME?
How I currently do it:
Prepare MFMailComposer
Save the mail as a draft
Switch to native mail app
Open said draft
Send draft (which is automatically encrypted/signed by opening it directly from the mail app)
This seems unproductive.
Why I want MFMailComposer: If internet is unavailable, mail will be put in the outbox and sent automatically as soon as internet is available. If there is a solution to my S/MIME problem that doesn't rely on MFMailComposer, it has to have this "automatic-send"-feature.
Apple does not allow you to sent emails without MFMailComposer (because it would be easy to abuse).
The only way I can think of is to send your email to your sever and and encrypt it there/send it. You can always check if there is no intenet connection and write the contents of the email to a temp file and send it when internet is available.
Hope this helps.
Regards.
I have implemented a calendar in my website (Ruby on Rails) and i have also successfully generated an .ics file. I want to send this file as an attachment in an email.
I have set the mime as text/calendar
I also set the content_type as multipart/alternative
The attachment is sent successfully in the email on all major email clients except gmail
How to make the .ics attachment appear in the email. has anyone faced this kind of a problem before. I checked in various google help forums and many have faced this issue, but no concrete solution has been found.
In Gmail, click the "more" down arrow. One of the options is "Show original". Select that.
When the window opens, scroll down. You should see the VCalendar area. Gmail is ignoring it.
In this area, look for the line that starts as "Organizer;" If you are listed as the organizer, then gmail ignores the ics file. This is a "feature"
We built a web page for ourselves that we copy that text into and it strips that line out and re-emails the ics to us. Then it works fine. (with just a little more work, you could set up an email intercept wherein you forward that email to someplace where you have a parser that grabs the VCalendar, strips out the organizer, and emails it back to you.
We asked Google to put a feature request in to change this, but it's unlikely to happen.
Good Luck.