Questions tagged [wp-mail]

wp_mail() is a wrapper for PHPMailer which is a wrapper for PHP’s mail() function.

Filter by
Sorted by
Tagged with
2
votes
1answer
171 views

How to setup SMTP for only one specific wp_mail()

I just want to setup SMTP for a specific instance of wp_mail(). I have tested plugins like "Easy WP SMTP" and also checked how to set up SMTP manually but all these apply to the entire site and then ...
2
votes
1answer
6k views

How to create a CSV on the fly and send as an attachment using wp_mail?

I'm trying to create a CSV file from a form submission and send that file automatically by email to a specific user. The email itself is sending fine, but I can't get the attachment to go through. Is ...
2
votes
2answers
17k views

wp_mail() is not working on server

I am breaking my head from last 1 hour but not getting any idea that what's going wrong with my code... I am developing my own plugin and I am using wp_mail() function for sending mail in that but it'...
2
votes
1answer
27 views

wp_mail not running inside Cron

The wp_mail() function is not running when scheduled in a cron function. I have added the following function: add_filter( 'cron_schedules', 'isa_add_every_one_minutes' ); function ...
2
votes
1answer
159 views

Send automatic emails to multiple user roles when a custom field is updated in a custom post type

I'm trying to incorporate a 'Register interest' button into a website which when signing up will assign register the user to a user role and then when a custom field is updated in the property (CPT) ...
2
votes
1answer
1k views

wp_mail line break not working

I have an interface to send e-mails through SMTP (I use the plug-in Postman SMTP). I collect messages in the DB that I sent to someone depending on the results of an SQL request. In the DB, I stored ...
2
votes
1answer
7k views

Can I configure WordPress to use postfix without a plugin?

I am developing a WordPress site on a vagrant box and have installed postfix in order to test email notifications. At this guest OS (Ubuntu) level, I am able to end a test email: echo "Test mail ...
2
votes
1answer
2k views

Do I have to override the wp_mail() pluggable function with writing a plugin?

If I want to override wp_password_change_notification, do I have to write a plugin to do this? It seems to have no effect in functions.php of my theme. The only thing I need to do is change the ...
2
votes
1answer
29 views

Must I change the admin user email address while changing the general email address?

I changed the email at Settings > General from me@gmail.com to info@mysite.com. It seems like the email didn't change, although I received the confirmation email to change. I'm still receiving emails ...
2
votes
1answer
41 views

User invite email not delivered - related to subdomain?

I have a problem where, on a new install of WordPress, I want to add a new user, but the user is not receiving the email with the confirmation link. I've done some research and understand that this ...
2
votes
0answers
224 views

Unexpected = (equal sign) characters in wp mail

I have created a custom form for user registration and a custom html email when someone registers. $headers = 'From: test<ttest@test.org>' . "\r\n"; $subject = 'Test Subj'; $msg=''; $msg .= '...
2
votes
2answers
757 views

Processing a subscription form with POST method?

I am trying to integrate a ‘subscribe to newsletter’ feature on my wordpress blog Users just need to enter their name and email address, hit subscribe. This is then supposed to send me an email and I ...
2
votes
2answers
1k views

Send specific users an email when posts are published

I've got the following code, which is supposed to run when a new post is published for the first time, check if a custom field 'specific_users' has data (this uses Advanced Custom Fields), and if so, ...
2
votes
2answers
79 views

How to email user after inserting the username in database in WordPress

I have following piece of code, which inserts usernames and other details of users in the database. After inserting the usernames I want to email them using wp_mail();. I am unable to do so. How can I ...
2
votes
1answer
792 views

wp_mail isn't making the from header correctly

So I've got a couple of different plugins which I'm attempting to change the from address of the email header. I've tried using the filters, but it's simply sending the email as the admin user ...
1
vote
2answers
4k views

wp_mail very slow

I have a question about the wp_mail() function. Right now I'm having the following button to send e-mail with: echo '<input type="submit" name="send_button" value="verzenden" id="'.$post_id.'" ...
1
vote
6answers
6k views

How to stop the wp_mail function?

I'm using wp_mail filter function. add_filter('wp_mail','check_the_mail_content'); If my condition satisfied then the mail should go, otherwise I need to stop, my function is add_filter('wp_mail','...
1
vote
3answers
8k views

wp_mail attachment not working

Hello I am trying to send mail with some attachment using with wordpress wp_mail functionality but I am not getting attachment in my mailbox. Can you please check my bellow code and guide me where I ...
1
vote
3answers
192 views

Different Webhost and using Google Mail server: Is there a better way than SMTP?

Currently my situation is the following: I am using Wordpress which handles a few things mail related: Registration forms that send a notification and contact form that send a message. However, ...
1
vote
2answers
7k views

wp_mail recipient array not sending?

I am using wp_mail to send an email to multiple recipients. my mail function looks like this: wp_mail($group_emails, 'my subject', 'my message', $headers); $group_emails is an array of email ...
1
vote
3answers
6k views

Need clarification on how to correctly call wp_mail()

I want to call wp_mail() from a non-template PHP file, but when I do, it fails and I don't understand why. For example, let's say I have a PHP file that consists of only this: <?php echo 'hi'; ...
1
vote
2answers
6k views

How to add line breaks to $email['body'] when using auto_core_update_email hook

I am using the auto_core_update_email hook to modify the auto update email sent by WordPress. However I cannot figure out how to add line breaks to the email body. Here's my code: function ...
1
vote
1answer
78 views

Email 'from address' has a www in it

When sending emails from my WordPress install, my 'from address' includes a www. Currently, it's sending email from web@www.domain.com when what I want is web@domain.com. However, if I change the ...
1
vote
3answers
20k views

Sending HTML email with attachment with wp_mail()

This one should be easy, but I can't figure it out. I want to send an email that is HTML formatted, but also has an attachment. The attachment is being sent correctly, but the message is delivered as ...
1
vote
1answer
1k views

How to make WordPress emails async

I recently had an issue on my site where emails were failing to send. That was a problem, but the bigger problem was that the failure caused the script to timeout which really put a damper on the user ...
1
vote
1answer
3k views

How to send email in wordpress with more than one attachments

In my plugin, there is a contact us form through which users can upload multiple files and it will be uploaded into wp-contents/uploads/2014/10 folder. Uploading is working, but now I need to send ...
1
vote
1answer
2k views

Change email from and display name with a filter action

I'm attempting to override the "from" display name and email address using the wp_mail() function. I am using the wp_mail_from filter hook to modify it with my custom function using add_filter('...
1
vote
1answer
2k views

Why wp_mail() function isn't sending any emails and displaying '0' in Chrome 'Network' response

I'm trying to send emails through WordPress using the wp_mail() function and it doesn't seem to work. It's displaying 0 in Chrome 'Network' response with Status Code:200 OK This is my code part: ...
1
vote
1answer
973 views

Validate emails in array using foreach

How do I validate an array of emails from a textbox before sending them to the wp_mail() function? $emails = 'test@test.com;test2@test2.com email3@email3.com,email4@email4.com, email5.com'; $emails =...
1
vote
2answers
2k views

Adding second Email address for WP user notifications

The WP systems sends a lot of mails to authors. There also plugins who use email notifications for authors. But, let say I have a user, who is managed by two persons (because it's a company, an ...
1
vote
1answer
124 views

Wordpress wp_mail() how to add a .GIF

I'm using wp_mail() to send e-mail from our website. However, we would like to include a .gif file on the body of our message. Here's my code, but it's not working. $to = $contact['Email']; $from = '...
1
vote
2answers
472 views

wp_mail() sends wrong From header

When using this code below with wp_mail() I always get in the header wordpress@mydomainname.nl. And in Thunderbird in column Correspondents: Wordpress. But I need: 'From: "Klantenservice"<' . $...
1
vote
3answers
3k views

PHP mail() works but wp_mail() does not

I'm totally lost by the mail function in WordPress (WP 4.6 multisites). I tested locally (on my localhost) WordPress send mail. This works fine at first sight (I don't really know why because I've ...
1
vote
1answer
2k views

How do I call wp_mail from HTML?

This is meant to be up in the next week or so, but I am having a lot of trouble getting the site to send emails to an address specified in an input box. I need to use wp_mail as I need to be able to ...
1
vote
1answer
159 views

On user registration, if welcome mail sent, add post with new user as author

I am trying to create a new post (later will convert it into custom post type), whenever a new user register on the website and if the welcome email was sent succesfully. The problem is that I want to ...
1
vote
1answer
1k views

Remove from “Wordpress” when reciving email (Should I remove filter?)

I am getting "Wordpress" when I sending my email using wp_mail. So to remove "Wordpress" from my e-mail I am using filter like so: //Remove "Wordpress" when receiving email function ...
1
vote
1answer
643 views

Add a hook to wp_mail() to track Google Analytics Event

I hope you'll be able to help me on this one: I'm trying to trigger a GA event for every email sent via a Wordpress site. My idea was to add the following code to my child theme's functions.php file:...
1
vote
1answer
313 views

Email all subscribers when i do an action

I've created this function: function email_subscribed_users($event) { $users = get_users('role=subscriber'); foreach ($users as $user) { $accepted = get_user_meta($user->ID, '...
1
vote
1answer
27 views

Send emails with wp_mail() using SMTP configured in plugin

I have the plugin Easy WP SMTP installed and there I have configured sending my WordPress mails with SMTP. I send emails with a cronjob to my users with the wp_mail() function. I was asking myself, ...
1
vote
1answer
48 views

How do I set wp_mail arguments/manually force wp_mail sending based on the sender's email address?

I need a way to query the sender's email address before delivery is attempted, and then set wp_mail arguments depending on the results. So something like the following: If sender_email contains @...
1
vote
1answer
249 views

Redirect to another page after submission using wp_mail

I'm trying to redirect to user to another page after the form has been submitted using wp_mail. // Hooking up our functions to WordPress filters add_filter( 'wp_mail_from', 'wpb_sender_email' ); ...
1
vote
2answers
338 views

How to restrict sending email twice in wp_mail

I have created an Add / Remove Dynamic input fields. I am using wp_mail(); to send mails. I have restricted the first user from receiving mail. I want to send mail to other users. Everything is ...
1
vote
2answers
54 views

Restrict current user from receiving email using wp_mail

I have created a code through which the current user can add other users to his project. These users are only shown on the project page. They will not have any right to modify the project. Once these ...
1
vote
3answers
1k views

Unable to prevent function using save_post firing twice

I am using save_post for a function to send an email when a post is updated by a user. This is firing twice and I am aware this is due to the post revisions and autosaves. I have tried to prevent ...
1
vote
2answers
873 views

Mask Sender Address in wp_mail() in Wordpress [closed]

I am using wp_mail() function to send email to user in WordPress. I want to hide sender name like I want to mask sender email as noreply@gmail.com etc. Any help will be appreciated.
1
vote
1answer
466 views

wp_mail is not sending email if I pass an array of emails

On publish event CPT, I want to send emails to every participant set in the custom meta boxes. When I pass array as email addresses it is not sending email wp_mail( $employee_emails, $subject, $...
1
vote
1answer
715 views

Executing my function once on a specific time

On our WordPress website we are using the Events Manager Pro plugin. This allows us to create events. However we need to somehow send a thank you E-mail to the attending people 1 day after the event ...
1
vote
1answer
1k views

Send mail from page using wp_mail

How do I call the WP_MAIL function from a page which has a form? I would like to create a form in a page, and by pressing "Send" activate a function in the functions.php file, so the mail gets sent ...
1
vote
3answers
5k views

Change Default wp_mail From, Without Affecting Gravity Forms

I have a question about changing the default sender From name/email on default wp_mail notifications (e.g., Lost Password response), but WITHOUT it messing up notifications being passed on by Gravity ...
1
vote
3answers
1k views

How to send mail to subscribers using wp_mail

I'm just starting out with making plugins and I'm trying to make a simple one that will mail a notification to subscribers whenever I publish a new post. My code so far: add_action( 'publish_post', '...