attachment

Stream as an Attachment to System.Net.Mail is 0 bytes

人走茶凉 提交于 2019-12-02 21:50:43
I've got a project where I'm using a PDF generator to send a file to a user. We'd like to give the user the option to attach this file to an email instead, and we're having trouble using the Stream object and Attachment logic together. We start with ABCpdf, which has two save methods: it can save to a Stream, or if you give it a string, it'll try to save to a file on the disk there. We've done both no problem. Stream stream = new MemoryStream(); myPdf.Save(stream); Everything is mostly cool at this point - stream has several kilobytes of data, and if you .Save() to a file, you get an actual

Sending mail with attachments programmatically in ASP.NET

六月ゝ 毕业季﹏ 提交于 2019-12-02 21:09:35
I am dynamically generating a number of different types of files based upon a GridView in ASP.NET - an Excel spreadsheet and a HTML file. I am doing so using this code (this is just for the Excel spreadsheet): Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=InvoiceSummary" + Request.QueryString["id"] + ".xls"); Response.Charset = ""; Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); contents.RenderControl(htmlWrite); /

Is Rails Paperclip only for Images?

放肆的年华 提交于 2019-12-02 20:41:50
问题 Are there any rails libraries for managing file attachments connected with ActiveRecord? I know paperclip , but it seems suitable for images primarily. They indeed mention audio and pdf files on the github project page, but there's no further explanation about the usage of different file types. Attributes like :style would change their meaning if you uploaded an audio file. So different file sizes wouldn't be expressed in a two-dimensional resolution but in terms of bitrates. Are there any

AJAX cant load URL

放肆的年华 提交于 2019-12-02 20:30:55
问题 I am trying to use the youtube "api" for search http://suggestqueries.google.com/complete/search?q=INPUT&client=firefox&hl=cs but the site returns with a content-disposition: attachment; header and downloads a file (f.txt) with a JSON response. Is there a way to obtain the JSON as a string in javascript? (I am sure there is. Youtube has to do it somehow) jQuery-less please if possible. 回答1: Not sure how you are trying to access API in browser directly. It will not work that way. Make an AJAX

How to handle multipart/alternative mail with JavaMail?

泄露秘密 提交于 2019-12-02 17:19:56
I wrote an application which gets all emails from an inbox, filters the emails which contain a specific string and then puts those emails in an ArrayList. After the emails are put in the List, I am doing some stuff with the subject and content of said emails. This works all fine for e-mails without an attachment. But when I started to use e-mails with attachments it all didn't work as expected anymore. This is my code: public void getInhoud(Message msg) throws IOException { try { cont = msg.getContent(); } catch (MessagingException ex) { Logger.getLogger(ReadMailNew.class.getName()).log(Level

How to copy the contents of an attached file from an MS Access DB into a VBA variable?

烂漫一生 提交于 2019-12-02 16:28:45
问题 Background Information: I am not very savvy with VBA, or Access for that matter, but I have a VBA script that creates a file (a KML to be specific, but this won't matter much for my question) on the users computer and writes to it using variables that link to records in the database. As such: Dim MyDB As Database Dim MyRS As Recordset Dim QryOrTblDef As String Dim TestFile As Integer QryOrTblDef = "Table1" Set MyDB = CurrentDb Set MyRS = MyDB.OpenRecordset(QryOrTblDef) TestFile = FreeFile

How to pass attachment from file browser and camera in a custom mail sender

梦想的初衷 提交于 2019-12-02 16:07:56
问题 I have used a tutorial to implement a custom email sender, now I have this code try { m.addAttachment("/sdcard/filelocation"); if(m.send()) { Toast.makeText(Comunic.this, "Ok", Toast.LENGTH_LONG).show(); } else { Toast.makeText(Comunic.this, "Error.", Toast.LENGTH_LONG).show(); } } catch(Exception e) { Toast.makeText(Comunic.this, "Error.", Toast.LENGTH_LONG).show(); } And need to pass in m.addAttachment("/sdcard/filelocation"); a file selected from the file browser or a photo(according the

PHP: Add attachments to emails “on the fly”?

▼魔方 西西 提交于 2019-12-02 11:56:41
问题 I just got PHP's mail function to work properly in my test environment. I have a PHP app that outputs a number of strings. It would be really nice to convert these strings to attachments ( *.TXT -files) in an email, without first storing them on disk and having to read them back. Would this be possible in PHP? 回答1: Yes, this is possible. You just need to make your email message a multipart message with the following syntax: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=random

Android: Correctly downloading/saving an email attachement

試著忘記壹切 提交于 2019-12-02 10:56:11
问题 I have an interesting problem: My application is designed to send and open up a zip full of files, and the zip has a special extension (easier for the user). I can zip up the files I need to attach in an e-mail, and I can send them. When I use the g-mail "view" button and select my app to open the file, it doesn't unzip them correctly. However, if I use the gmail "download" button, and then open the file through a file explorer, the file unzips correctly. This is the code I use to download

My php script for mailing a form is not working

我是研究僧i 提交于 2019-12-02 09:51:10
I am trying to set up a form that will send attachments along with the email content, but I have no idea what I am doing. I am completely new to PHP, and just learned to do the basic mail form work by, basically, trial and error, along with tutorials on the internet. But, when it came to attachments. Now I am completely at loss. And, although the PHP script supposedly runs, and the file is uploaded, all the operation stops all of a sudden. Neither do I get the messages that should show when the scripts finishes running nor do I get an email with the test message and its attachment. Can anyone