You should take a look at wp_mail on the codex. This will do everything you need, and it’s “the wordpress way”. There are also particular controls for attachments.
Basic usage is:
<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>
Related Posts:
- Disable email notification after change of password
- Notify comment author upon reply
- Send email with list of active plugins upon activation/deactivation
- WordPress: Add custom add_filter for custom functions
- How to change a wordress plugin php code in my child’s functions.php file?
- Form tries to download a file on submit
- wp_dequeue_style not working
- Send email when a new post is published [closed]
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- how to customize hello dolly plugin?
- Adding Custom Fields for Img in Posts
- How to pass JavaScript variable to PHP in wordpress widget?
- Unable to add admin notice on plugin activation
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Deleting images through upload folder, but not deleting from media library
- How to restrict an entire WordPress site to visitors, but the register and login page?
- How to exclude a widget from page 1 of a paginated post
- Storing a password for use with a WordPress plugin
- Adding a post shortcode to a page template?
- Sort products without thumbnail in WooCommerce shop page
- Create or Update thousands of woocommerce products via PHP
- send_headers don’t work on wordpress multisite
- Update Option Error: Notice: Undefined index
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- Custom Post Type Plugin not loading category template and loading 404 instead
- How to generate video out of images via WordPress plugin
- How to ‘clone’ a wp plugin to make small changes
- add mediaelement.js plugins into WordPress video player control bar
- Email Bounce Address
- How can I add hyperlink in WP_Error message?
- WordPress WPforms customization
- How to save inputed data in a textbox [EDITED] [duplicate]
- Replace default og:image tag YOAST
- Where these .js file come to source code?
- WordPress Payment gateway add on form , how to add form into list or else how to submit form to next step for payment
- Center and hide overflow of WP toolbar custom links
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- Conditional tag doesn’t work in WordPress plugin
- PHP Fatal error: Call to a member function locale() on a non-object
- Implementing an “Email this” button?
- How to check if an email was sent from or originated from a specific plugin?
- Why can’t I call a (member) function from within a foreach?
- WordPress Related Plugin – only show when related content
- Are there action hooks for comments?
- Collecting email addresses via a “beta” sign up form
- syntax error, unexpected ‘while’ (t_while) please help :)
- PHP if statement with German umlauts [closed]
- Why does this code snippet create a critical error on my site? [closed]
- How to redirect non www to www? [closed]
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Must use Plugin not updating HTML code in head
- Plugin not working locally, but works on server
- Disable Checkbox depending on state of another checkbox
- Cannot access empty property error in Advanced Access Manager
- Plugin to send messages to members/lists but not full-blown newsletters
- Somehow adding to “Insert Into URL” posts are contradicting each other
- Pasting this PHP breaks my page. Why?
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- WordPress Cache delete on plugin uninstall
- How to create repeater field manually, without plugin (ACF Pro)?
- can’t unzip file
- Woo-commerce Update price as a Bulk from My offline software export
- WordPress jQuery Post – Amending Variable Value Within Function Command
- how to display recent post by category on home page
- WordPress Custom Hook with Class method
- Open_basedir errors – But setting basedir to none redults in 502 Bad Gateway
- Auto delete empty posts
- Change plugin descriptions
- WordPress Standard Fix Errors
- How can I find related learndash course id from woocommerce product object?
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- Try to debug a plug-in written by someone else
- How to use Datatable with Ajax when creating plugin on WordPress?
- Use modulo condition in ACF repeater Field
- Showing how many times is plugin activated or deactivated
- Redeclare a plugins function/class in my theme?
- Send email when a user registers Rest api
- Return function results within shortcode
- get/show Last ID
- Help with customising love it plugin (use within foreach)
- insert multiple entries in database using a loop issue
- Query Shortcode from a multisite to appear on a different site?
- How to echo a plugin’s function into a template?
- Theme editor removes backslashes
- Retrieve data from multiple WordPress sites using PHP script
- Trending Tags based on post views
- It possible to implement an adhoc php web application with wordpress?
- Plugin Hook: Get posts
- date function not correctly returning date
- Edit Buddypress Groups Activity Page Text [closed]
- I want to remove the register/login WordPress top bar from my website
- How to prevent page load on form submission
- how to add “alt” for all image in wordpress
- Send email notification when meet the condition
- WordPress: code structure
- How to add a text in the checkout page woocomerce?
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- How to fix template and image buffering issues on website [closed]
- PHP FATAL ERROR