attachment

send email with attachment in php without saving the file to webserver

核能气质少年 提交于 2019-12-05 23:05:17
问题 I am creating a simple form that let user "upload" a file, and a comments box. after the user choose the file(can be image or pdf) and click submit, i am not gonna store the file into my web server, the file will be inserted into an email and send to me. my question is: how can i attach the file without storing it in any place. I don't want to use third party module. Update: $attachment = $_FILES["OrderList"]["tmp_name"]; $content = file_get_contents($attachment); $content = chunk_split

How to rewrite and set headers at the same time in Apache

好久不见. 提交于 2019-12-05 21:46:12
I have a directory of images that alternately be viewed directly in the browser, and other times downloaded. So, say I have a file /gallery/gal_4254.jpg. I want to make /download/gal_4254.jpg trigger a download of the image rather than view it. /download is empty, all the images are in /gallery. I can map requests to the download dir to the other files successfully <Directory /var/www/download> RewriteEngine on RewriteRule (.*)$ /gallery/$1 </Directory> and I already can force downloads in the gallery dir by setting <Directory /var/www/gallery/> ForceType "image/jpg" Header set Content

Serialize a FileStream for transport

馋奶兔 提交于 2019-12-05 19:54:22
See also this question: Can I pass a System.Net.MailMessage to a WCF service? I'd like to add attachments to the mail being sent. Attachments are either files on the local disc, or dynamically created Streams. A WCF contract can contain a Stream, but only when all arguments are of type Stream. So, what is the best way to pass one or more Attachments to a WCF service? Alright I've solved this myself. The trick here is to convert the attachment to a Base64 encodes string, much the same way email systems do this. I've created a class to handle this. Posted here for others: [DataContract] public

Base64 email attachments are not uploading

China☆狼群 提交于 2019-12-05 19:09:17
I am using the following script http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/ to handle my emails that get sent to me, however it seems if a user sends an email from mail or outlook or any email client that sends base64 attachments they are not being saved in the data base, and the body text of the email is also skiped. I am wondering if anyone sees an error in the code, as I have looked and dont see anything that sticks out. a closer look shows the following Mail.app sends its base64 like this. --Apple-Mail=_9E76B10A-4086-43B8-B835-78F184FA43FC Content

Searching attachments from a Rails app (Word, PDF, Excel etc)

匆匆过客 提交于 2019-12-05 16:26:33
My first post to Stack Overflow so be gentle please! I am about to start a new Ruby on Rails (3.1) project for a client. One of their requirements is that there is a search engine, which will be indexing roughly 2,000 documents which are a mixture of PDF, Word, Excel and HTML. I had hoped to use either thinking-sphinx or Texticle (most popular at https://www.ruby-toolbox.com/categories/rails_search.html ) but as I understand it: Texticle requires PostgreSQL. I'm on MySQL. thinking-sphinx doesn't index files on the file system. even if I saved my attachments into the database, thinking-sphinx

How to get filename of all attachements of email?

人走茶凉 提交于 2019-12-05 16:11:59
I am trying to get the filename of all the attachements of emails using java and imap.My code is: MimeMessage msg = (MimeMessage) messages[i]; String fileName = msg.getFileName(); System.out.println("The file name of this attachment is " + fileName); but it prints null always even if email contain attachment..I have seen different codes on SO but none worked...and I don't know what to do if attachment is more than one . PS:I only want to get the filename and don't want to download attachments. First, to determine if a message may contain attachments using the following code: // suppose

PHP sending mail attachments

北战南征 提交于 2019-12-05 06:09:21
问题 I found the post about adding attachments to the mail. The question is how to connect uploaded file with that function? What I have to pass? UPD: echo '<pre>'; print_r($_FILES); echo '</pre>'; $uploads_dir = '/uploads'; // It has need rights $tmp_name = $_FILES["vac_file"]["tmp_name"]; $res = is_uploaded_file($tmp_name); // This is true $name = $_FILES["vac_file"]["name"]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); echo '$tmp_name: '. $tmp_name . '; $name: ' . $name; → Array ( [vac

Change error validation message in Paperclip

痴心易碎 提交于 2019-12-05 04:51:20
When you set a validation message in paperclip, such as validates_attachment_presence, :image, :message => 'xxxx' The custom message comes automatically prefixed with the name of the field, even though it has been overwritten with the :message . How do you totally override the message and make it totally custom? Edit: typo Not a real solution but a Easy one is to skip paperclip validation and write custom one. validate :check_content_type def check_content_type if !['image/jpeg', 'image/gif','image/png'].include?(self.image_content_type) errors.add_to_base("Image '#{self.image_file_name}' is

ICS in Outlook being sent as a .msg file

扶醉桌前 提交于 2019-12-05 04:31:25
I have an application, it is creating an ICS similar to the following: BEGIN:VCALENDAR VERSION:2.0 METHOD:REQUEST BEGIN:VEVENT ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:test1234@gmail.com ORGANIZER:MAILTO:test1234@org.com DTSTART:20100803T190000Z DTEND:20100803T200000Z LOCATION:Go to http://100.200.0.55/Login/ParticipantLogIn.asp and enter Conference ID: 0000 SEQUENCE:0 UID:352C75A6-0117-4B3A-AFE6-7B18649CD45A DTSTAMP:20100803T184455Z DESCRIPTION:TO ACCESS THE WEB CONFERENCE:\n\n Click on the link bel ow:\n SUMMARY:Test User's Conference PRIORITY:5 CLASS:PUBLIC BEGIN:VALARM TRIGGER:-PT15M

Access Gmail attachment from a chrome extension?

血红的双手。 提交于 2019-12-05 03:46:12
问题 Hi I am trying to write a chrome extension which needs to read in an email attachment (plain txt). I feel this should be possible as gmail gives you a download link, however it is not a direct link does this make it impossible? I have the following code to read a remote file which works just not for gmail: <script> var txtFile = new XMLHttpRequest(); txtFile.open("GET", "http://remote.com/remote_file", true); txtFile.onreadystatechange = function() { if (txtFile.readyState === 4) { // Makes