Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP email with excel attachment

Featured Replies

Hi Guys,

 

This is annoying the hill out of me, I am trying to send an email with excel attachment using php.

Do any one have any code?

 

 

Youssef

Hi Guys,

 

This is annoying the hill out of me, I am trying to send an email with excel attachment using php.

Do any one have any code?

 

 

Youssef

 

http://www.finalwebsites.com/forums/topic/php-e-mail-attachment-script

 

basically, you need to encode your excel attachment with base64, split it into chunks, set content encoding to 7bit and add that encoded string to the content of the email.

  • Author

Thank you for your reply,

This is a good place to start, but I am not sending a zipped folder I need to send an excel file.

The excel file is in a folder called xsl so the path is xsl/working.xls.

This will sound stupid, but in the same time I am new to php, here is the code:

 

$headers .= "Content-type: text/html; charset=us-ascii\n";

$headers .= "MIME-Version: 1.0\n";

$headers .= "Content-Type: application/octet-stream; name=\"xsl/\"\n";

$headers .= "From: $business\n";

$headers .= "Content-Disposition: attachment; filename=\"working.xls\"\n\n";

@mail("info@siblinis.com", "AB-MXR", "hello is it working ", $headers);

 

 

 

Youssef

 

http://www.finalwebsites.com/forums/topic/php-e-mail-attachment-script

 

basically, you need to encode your excel attachment with base64, split it into chunks, set content encoding to 7bit and add that encoded string to the content of the email.

Thank you for your reply,

This is a good place to start, but I am not sending a zipped folder I need to send an excel file.

The excel file is in a folder called xsl so the path is xsl/working.xls.

 

it doesnt really matter what you want to send, all you need to do is to open that file (fopen), read its content (fread), encode it (base64) and concat with your email's body (content data).

 

 

you can try to use that mail_attachment function from this page, just instead of giving .zip file as an argument try to put your .xls file :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.