Finally I figured out the cause and solution to my problem above.
When I send email in sub domain such as http://test1.example.com without a custom “From” address in header, the wp_mail()
function itself sets the default “From” address as [email protected]
. This is invalid so the email was not sent.
To solve this, I added a custom “From” email to the header like this:
$headers[] = 'From: Sender Name <[email protected]>';
This sets a valid email address in the header.
You can also set the same using filters like this:
add_filter('wp_mail_from', function( $email ) {
return '[email protected]';
});
add_filter('wp_mail_from_name', function( $name ) {
return 'Sender Name';
});
Related Posts:
- Multisite not using subdomains as hostname in from address when sending emails
- Google Apps SMTP for WP MultiSite?
- Multisite – SMTP not working on other network sites
- Sending SMTP mail using a server with self-signed SSL
- Overriding the default WP Multisite notification e-mail
- Stop wordpress from sending out moderation emails
- Need to manually regsiter user, send the password and retreive their user ID
- Emailing only the users of a MultiSites Sub-Sites
- Howto disable comment moderation emails for admins, but not for authors
- Activation Account Email
- Multisite + wp_mail – Route Via Site Conditionally
- Why won’t wp_mail() let me set the From: header when plain old PHP mail() will?
- Multisite on Windows with wildcard subdomains
- multisite 404 error for subdirectory
- How to hide or remove unwanted widgets on Multisite installation?
- How to use alias domain for multisite installation?
- Multisite htaccess on localhost with WP as an SVN external?
- WordPress Multisite with multiple domains using Nginx
- wp_mail script with jQuery post
- NGinx + WordPress Subdomain Multi with core in Subdirectory
- Redirect to a Plugin Settings Page After Multisite Site Creation?
- WordPress Multisite – Multiple subfolders for blogs
- Uploading/Deploying a Multi Site Install
- How does wordpress multisite manage subdomains?
- Is it possible to fix/repair all Index, Primary Key, Unique (and all other) structure of a WordPress MS Database
- Trying to migrate a WordPress Multisite with Domain Mapping
- Manipulate list of themes in wp-admin
- How to update_site_option for specific site within network?
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- How to run nested xargs commands?
- How to add edit users capability to a custom role?
- How to change the database prefix in multisite (WPMU) install
- Wordrpess Subdomains (Multi-Site) without Wildcard
- Subfolder Multisite : optional www subdomain
- Efficiently manage a huge number of blogs given server-side restrictions
- WP MU – Accessing ‘Domain-Mapped’ WP-Admin with a subdomain
- Accessing multiple sites via FTP
- Icon font not working on subdomains of multisite
- Getting this code to work in Multisite
- Search post in all blogs in WPMU?
- Multi-site: removing /blog from posts
- Multiple install for multilanguage. How to?
- Migrating Multisite – Database error, missing wp_blogs table
- Sitewide category terms
- What is the function to get options of the parent site of a multisite network?
- Issue with htaccess redirection in WP Multisite
- Multisite – sort merged get_posts() queries
- WordPress MultiSite login to the respective site
- How to detect the context of homepage for a wordpress mu sub-blog
- Multsite redirecting to the main site
- WordPress MU Domain Mapping Just Redirects to Main Site
- How to make a php script(app) accessible to all wordpress subdomains in a wordpress multisite configuration?
- Multisite: cloning, but also updating too
- Using the standard WordPress “New User” interface on a multisite
- Add multisite switch button. Click to switch to other page in same admin area
- WooCommerce Multisite — importing products IN subsites FROM main site
- Efficient way to handle translations with Multisite WordPress installation
- 301’s not working with multisite
- How to create multisite roles with predefined themes
- Can I safely remove banned names from WordPress?
- Multisite install w/ Sub domains on a subdomain
- WordPress front end posting to multiple blog in multisite with advanced custom field
- Simplest way to query with blog_id?
- WordPress Multisite – Load users using custom query
- Detach site from multisite (turn off multisite)
- How to wordpress multi site [closed]
- Is it possible to load wp-content/uploads from another server?
- Domain Mapping subsites of an Add-on Mulsite Domain
- Trying to change active theme on all sites in Multisite
- Multi-Site / Single Site Decisions
- Multi-site site nav, wpdb->prepare missing argument
- Images in wp_mail not showing
- What’s the best way to get posts from one multisite blog into another?
- Publish all network posts to the primary site
- query multisite blog for post by tag
- WordPress Multisite on multiple sub-domains
- How to migrate post media from stand-alone to multisite build
- Multisite network admin login redirect
- Seeking solution to sync wordpress sites with Server
- All Multisites are working as one site
- Filter wp_mail based on content type
- How to add WordPress site to multisite network when both are addon domains
- Get posts by user role in a Multisite
- WPLANG option not available in localhost
- How can I make my existing VIP theme to multisite
- how to make a cronjob run, when user needs to be logged in
- All Subsites of a WordPress Multisite install 302 redirects to the main site
- Sending email with wp_email and AJAX
- How to find the site ID on a single site and then add new post with “`multipart/form-data” enctype?
- Apply Lazy loading/Infinite scroll on array data
- WordPress Domain Mapping shows new domain in place but takes me to the sub domain
- How can I have different langauges in wp-admin on a multisite installation?
- Problem in viewing recent posts from network site to main site
- Send data using GET method not work correctly
- How to create Network of websites with separate database in WordPress
- WordPress multidomains and subfolders
- WordPress shows death white screen on multisite
- Create service similar to wordpress.com [closed]
- External rewrite rules missing in htaccess – Multisite
- Run WordPress multisite from secondary volume on AWS EC2