email form attachment not working without the attachment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: email form attachment not working without the attachment

Post by social_experiment »

The code below is what i receive when i send an email via the script. I attach a file, but it doesn't get sent.

Code: Select all

 
webmaster@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; 
boundary="_1_df6a564a3824fb8a39b172209cd33a22"
 
This is a multi-part message in MIME format.
  
 --_1_df6a564a3824fb8a39b172209cd33a22
 Content-Type: multipart/alternative; boundary="_2_df6a564a3824fb8a39b172209cd33a22"
  
 --_2_df6a564a3824fb8a39b172209cd33a22
 Content-Type: text/plain; charset="iso-8859-1"
 Content-Transfer-Encoding: 7bit
  
 
 Email = $email
 Name = $name
 Phone = $phone
 Occasion = $occasion
 Age = $age
 Flavor = $flavor
 Filling = $filling
 People = $people
 Month = $month
 Day = $day
 Delivery = $delivery
 Text = $text
  
 --_2_df6a564a3824fb8a39b172209cd33a22--
 --_1_df6a564a3824fb8a39b172209cd33a22
 Content-Type: application/octet-stream; name=""
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment
  
 
 
 --_1_df6a564a3824fb8a39b172209cd33a22--
 
I also receive the following error when running the script (even though the mail is sent)

Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in EmailSend.php on line 44

Are you receiving something similar?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
wak0
Forum Newbie
Posts: 22
Joined: Wed Jan 20, 2010 2:31 pm

Re: email form attachment not working without the attachment

Post by wak0 »

when i attach a file, it does reach the email, but when i dont have an attachment, i get that error.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: email form attachment not working without the attachment

Post by social_experiment »

It might sound like bad coding practise but i'd suppress the error. Until i could figure out the problem.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
wak0
Forum Newbie
Posts: 22
Joined: Wed Jan 20, 2010 2:31 pm

Thank you

Post by wak0 »

Any luck
Post Reply