Pawan Kumawat

Change Sender Name And Email in Outgoing WordPress Email.

To change the sender name and email in outgoing WordPress emails, you can use the `wp_mail_from` and `wp_mail_from_name` filters. Here’s how you can do it:

1. Open your theme’s `functions.php` file or create a custom plugin file.

2. Add the following code to modify the sender name and email:

 

/**
 * Change the sender name in outgoing emails.
 *
 * @param string $from_name The current sender name.
 * @return string The modified sender name.
 */
function change_email_sender_name( $from_name ) {
    // Replace 'Your Sender Name' with your desired sender name.
    return 'Your Sender Name';
}
add_filter( 'wp_mail_from_name', 'change_email_sender_name' );

/**
 * Change the sender email address in outgoing emails.
 *
 * @param string $from The current sender email.
 * @return string The modified sender email.
 */
function change_email_sender_email( $from ) {
    // Replace 'your-email@example.com' with your desired sender email.
    return 'your-email@example.com';
}
add_filter( 'wp_mail_from', 'change_email_sender_email' );

3. Customize the `Your Sender Name` and `your-email@example.com` values with your desired sender name and email address.

4. Save the changes to the `functions.php` file or activate the custom plugin.

After implementing these changes, outgoing WordPress emails, such as contact form submissions or notifications, will use the updated sender name and email address.

Categories

Related Blogs

Add Custom Price on Bulk Purchase in Woocommerce Using ACF

To achieve this functionality, you’ll need to create a custom ACF repeater field for quantity and price in the product admin panel and then display all the prices on the product single page. Additionally, you’ll have to calculate the price according to the selected quantity when a product is added to the cart using WordPress hooks.

How to log information, warnings, errors In wordpress

To create a custom write_log() function for WordPress, you can use the error_log() function to write messages to the error log. This function will allow you to log information, warnings, errors, or any other messages during development or debugging.

How to Remove Product Tabs on Product Page

To remove product tabs on the WooCommerce product page, you can use the `woocommerce_product_tabs` filter. This filter allows you to modify or remove the default product tabs provided by WooCommerce. By removing the tabs you don’t want, you can customize the product page layout to suit your needs.