attachment

Set Email Attachment name in C#

南楼画角 提交于 2019-12-03 10:21:11
I add an attachment like this: System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(AttachmentPath); msg.Attachments.Add(attachment); But I want to make it attach as a different name, the actual file name is very long and confusing I would like it to attach as "file.txt", is there an easy way to do this without having to make a copy of the file? Kev How about: System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(attachmentPath); attachment.Name = "file.txt"; // set name here msg.Attachments.Add(attachment); You need to load the attachment from a stream and

Get attachment from unread MMS messages

十年热恋 提交于 2019-12-03 09:54:20
I would like to get attachment from unread MMS messages, but the codes I have doesn't allow me to do so. How do I go about doing that? Codes modified from here : private void checkMMSMessages(){ // Create string arrays to store the queries later on String[] columns = null; String[] values = null; // Calls the ContentResolver to query for columns with URI "content:mms" Cursor curPdu = getContentResolver().query(Uri.parse("content://mms"), null, null, null, null); if(curPdu.moveToNext()){ //String read = curRead.getString(curRead.getColumnIndex("read")); // Gets ID of message String id = curPdu

HtmlUnit download attachments [closed]

大城市里の小女人 提交于 2019-12-03 09:36:59
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I need to save files from websites Using HtmlUnit . I am currently navigating to pages that have several anchors that use javascript onClick()="DownloadAttachment('attachmentId')" to get the files. The files can be of pretty much any type ( xls, doc, txt, pdf, jpg, etc). So far

Sending a simple attached file via PHP mail() function

情到浓时终转凉″ 提交于 2019-12-03 09:11:27
I'm going to give this another try because my last question might have been confusing. I have a simple web form consisting of the following some inputs (for now, pretend i have two inputs, name and file input). I want the user to upload a document (if possible restrict to .doc, .docx, .pdf, if this is not possible to accomplish, let's just restrict to .doc), and i want to restrict the size to under 2MB. Let me rephrase this. The file to be attached is NOT on the webserver. It will dynamically be uploaded to a temporary folder, send via the mail script, and then deleted. If this is possible to

JavaMail sending mail attachment from string - encoding UTF-8

邮差的信 提交于 2019-12-03 08:31:51
问题 My application has to send a textfile, which it first has to generate as a String. The text contains non-ASCII symbols, so i would like it to be UTF-8. I've tried a lot of variants, but all i receive as the attachment is some question marks. And, when i send the same text as the message body, it works all right. Here is the line of code that generates the MimeBodyPart with the attachment: String attachment = "Привет"; messageBodyPart.setContent(new String(attachment.getBytes("UTF-8"), "UTF-8"

Adding an attachment to SOAP request

末鹿安然 提交于 2019-12-03 07:54:37
问题 I am at a loose end as to how to add an attachment in my SOAP request. We have to consume a thrid party web service, built in java, which is the most convoluted thing I have ever come across. Any other web services we have used, that required attachments, have a method or property to add the attachment. Simple. However, this one provides no such method. We have got a version of the SOAP message together that is exactly as we want the XML, however it is the MIME part of the file that we cannot

how to add .vcf file as attachment in application iphone

被刻印的时光 ゝ 提交于 2019-12-03 07:48:37
In my app I want to add .vcf file as attachment in MFMailComposeViewController. The documentation for MFMailComposeViewController shows that its addAttachmentData:mimeType:fileName: instance method is the way to go: - (void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename The attachment is the actual vcf file loaded or transformed into NSData. The mimeType for a vcf is @"text/x-vcard" . The fileName is whatever you want to call it, though you should uses the .vcf extension to ensure that email programs will understand it. Use the below code to

Sending mail with attachments programmatically in ASP.NET

徘徊边缘 提交于 2019-12-03 07:44:00
问题 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

Saving only the REAL attachments of an Outlook MailItem

爱⌒轻易说出口 提交于 2019-12-03 07:12:10
I'm currently developing an Outlook Addin which saves MailItems and Attachments in my MSSQL Database. I got a method where I save the MailItem with all it's attachments. But if I save all attachments the embedded images in the MailItem are also saved. Does anyone know how to save all real attachments?? I mean like the attachments in the picture below: and not the embbeded images that are in the mail body. Here is the code that I use to loop through all attachments of a MailItem and then save it: foreach (Outlook.Attachment att in mailItem.Attachments) { try { att.SaveAsFile(Path.GetTempPath()

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

怎甘沉沦 提交于 2019-12-03 07:11:46
问题 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