To attach a file to the email, you need to specify the Path to it like this:
<?php
$attachments = array( WP_CONTENT_DIR . '/uploads/file_to_attach.zip' );
$headers="From: Test Name <[email protected]>" . "\r\n";
wp_mail( '[email protected]', 'subject', 'message', $headers, $attachments );
?>
either is a string or an Array (for multiple files), you can see the accepted parameters here wp_email
. Not in the header like i can see here:
$header .= "Content-Disposition: attachment; filename=\"" . $FileName . "\"\r\n\r\n"; // For Attachment
Related Posts:
- How can I make my custom shortcode work in a Custom HTML Widget?
- How to trigger $_GET request within admin plugin page?
- How can I get WordPress to save comments in markdown format?
- How to translate to spanish wordpress hardcoded content/files?
- How to change a wordress plugin php code in my child’s functions.php file?
- Can’t access 3rd party API, code works on local server but not on wordpress
- How to create a “Most Popular” & “Latest” TAB in WordPress
- What are the differences between WPINC and ABSPATH?
- Disable email notification after change of password
- dealing with large HTML output via plugin code
- Problems with autoloading classes via sp_autoload_register / maybe interfering WP-specific autoloader
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Customizing subject in comment notification e-mails
- category_name not working (not showing up in sql query debug)
- Using require_once in a Plugin?
- Output in XHTML or HTML 5 for plugins?
- How to Loop Plugin Option Field Set?
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- Update Multiple Post Meta for the Same Post In One call?
- How to pass JavaScript variable to PHP in wordpress widget?
- Unable to add admin notice on plugin activation
- How To Ignore a Filter On Applying Filter the Content In a Function
- Saving Plugin settings to the database
- How do I configure WordPress to talk to a Microsoft SQL Server database?
- WordPress widget / plugin….fields not appearing in my widget
- Editor not displaying dynamically after clicking on the button
- Add CSS animation as Preloader to WordPress
- Rename existing old uploaded images containing accented French characters (not during upload)
- How to list the Hooks and order of execution in current loading page? [duplicate]
- How to Create a Directory in a Plugin Folder?
- Errors while using ajax from external wordpress page
- shortcode doesn’t work
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Create plugin that works in background
- Checking for user role in a custom plugin
- How to bulk send emails
- Deleting images through upload folder, but not deleting from media library
- HELP: Integrating WP with raw PHP code once published button is hit
- Loading class files via autoload method
- WordPress plugin installation
- How to add an attribute to the body tag with a plugin?
- I would like to use create a function in my custom plugin to tell WP to use a different header
- WordPress plugin for mail subscriptions [closed]
- Getting media library popup in custom plugin admin page
- Create or Update thousands of woocommerce products via PHP
- action-scheduler vs wp-background-processing
- send_headers don’t work on wordpress multisite
- jQuery function didn’t work in my plugin
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Escape when echoed
- Scope for PHP Variables Assigned in functions.php or a plugin
- Plugin exceeds memory limit
- Check if email address exists front end with AJAX in a plugin
- How to make a custom field as an editor in wordpress?
- Write to / remove from default .htaccess file from plugin?
- Update Option Error: Notice: Undefined index
- Plugin Development sqlite or WordPress’ database
- Sending email from inside a plugin using PHP PEAR
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How to generate video out of images via WordPress plugin
- WooCommerce get_price returning wrong price when used via ajax
- How to ‘clone’ a wp plugin to make small changes
- Open Post Thumbnail in New Child Theme File in WordPress
- Where should I save an API key of my user when installing my plugin?
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Programatically download a plugin
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- Redirecting to home page after login as custom role WordPress
- Add keywords meta to index.php page
- Custom form action to handle data inside a plugin
- Self deactivate plugins after an action occurs
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- WP Post Template – Templates in own folder
- Avoid class name collision when using third party libraries in plugins?
- wordpress plugin is not activating from widget
- Edit Yoast SEO breadcrumbs output [closed]
- How would I go about creating a user ranked post popularity page?
- Redirection of users away from wp-admin (but not administrators)
- Using a custom plugin to capture input data via Ajax and PHP
- code is working properly in Core PHP but writing coding in WordPress
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Image upload and download from front-end
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- wp_remote_get() returns 403 while file_get_contents() does not
- How to output CMB2 select options from repeated groups select elements?
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- What are the specifics of WordPress development I need to know? [closed]
- Ajax call returning 0
- How can i get the post’s full html source by its ID?
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- How to replace WordPress Media Upload Window with user’s device window?
- Conditional attributes and logic per product category
- How to insert HTML/JavaScript form into WordPress page? [closed]