473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to send attachment in email?

Hi All,

I want attachment to send with the email when a prospect clicks on submit button.

I used this code:

Expand|Select|Wrap|Line Numbers
  1. $allowed = array( 'jpg', 'gif','zip');
  2.  
  3. if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
  4.  
  5.     $extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
  6.  
  7.     if(!in_array(strtolower($extension), $allowed)){
  8.         echo '{"status":"error"}';
  9.         exit;
  10.     }
  11.  
  12.     if(move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/'.$_FILES['upl']['name'])){
  13.         echo '{"status":"success"}';
  14.         exit;
  15.     }
  16. }
  17.  
  18. echo '{"status":"error"}';
  19. exit;
but I could not receive any attachment in my mail, I'm new to PHP so Can anyone help me for this how can I get attachement in my mail.

Thanks in advance!
Mar 11 '15 #1
1 1134
Dormilich
8,658 Expert Mod 8TB
you don’t send emails with that code, that’s upload only.

anyways, I recommend to use a mailing library as setting up everything manually is a tedious and error prone job.
Mar 12 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
1
by: Sam | last post by:
Hi, I want to be able to send an email w/ attachment. I have an INPUT Type="File" HTMLControl on the page. User selects the attachment using this control. That's where I'm stuck. First, I...
5
by: Music Lover | last post by:
Is it possible to do the following? inside a ASP NET application, 1) send the current web page to the acrobat distiller printer. 2) attach the PDF file into an email message 3) send teh message...
10
by: Mike Charney | last post by:
Is there a simple way to send SMTP email from Access VBA? Mike m charney at dunlap hospital dot org
16
by: anya | last post by:
Hey, I have a certain problem and till now I didnt find an answer on the web. I want to send an email message with picture in it. I dont want to put it as attachment but make it in the body of...
9
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
5
by: =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= | last post by:
I have never sent attachment with webservices. Yesterday I got the challenge to redesign my solution that sends large XML structures to a Java webservice. The reason was that the Java SOAP...
1
by: Drews | last post by:
I need to be able to send an email from within Access AND be able to attach a file sourced from OUTSIDE Access. i.e. as with outlook. I am familiar with "sendobject" and have no trouble sending...
1
by: perhapscwk | last post by:
Below code works however it seems it will upload and save the attachment to server, how can send attachment without save the file into my server? and how to limit the file size to 3mb? $email =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.