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
0
votes
1answer
355 views

How to use PHPmailer in a function in WordPress

I have a function in the WordPress functions.php file that searches for a condition in user meta and sends an email to a user based on what it finds. I currently use wp_mail() to send the email, and ...
0
votes
2answers
1k views

How to display image in mail header using wp_mail()

How to display image in email header. I tried below, it in gmail it is not displaying the image. Please any one help me to resolve this. Thanks in advance. $to = $_REQUEST['userEmail']; $...
0
votes
1answer
760 views

Could not get attachment using wp_mail

I am trying to create a form which can be sent by users with an attachment. The form works fine and sending the emails when it is submitted but without the attached file. my form is : <form ...
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 ...
2
votes
2answers
427 views

Email reply to multiple email addresses not working

I want that email reply should be received at multiple email address. But it is not working for me. I have tried different ways but none of these working for me. I am trying this header but it is only ...
0
votes
0answers
38 views

How can I remove the product short description from the WooCommerce Mails?

I do have a rather large short description because it does fit perfectly with my theme, but unfortunately those information are added to the emails that are send to customers and mess with their ...
0
votes
1answer
424 views

upload file with front-end submission and forward the data in an email

I have an email set up using wp_mail that forwards my front-end submission data as well as posting it to the dashboard. The part that I am having trouble with is forwarding the attachment file with ...
3
votes
1answer
48 views

Claim Listing functionality - how to send email to users when their claim has been approved or denied

We have a claim listing plugin, it allows items(posts) to be claimed by users. It requires the user to "register" in order to claim that item therefore they have to enter a username and their email. ...
0
votes
0answers
39 views

Using a SendGrid transactional template with wp_mail

I want to use a SendGrid transactional template to format emails which I am sending using the wp_mail function. I'm sending emails like this: function mytheme_send_email($user, $message){ $...
0
votes
0answers
15 views

Send email details at user after registration

I'm using Wordpress and I realized my custom theme. Now I'm trying to manage emails (especially those to send to a registered user and password recovery) The problem now is that emails are not sent. ...
0
votes
1answer
205 views

Sending a custom form data in email through WP Mail Function

Before posting this post I have browsed these resources: On form submission how to send 2 email to different users https://stackoverflow.com/questions/17157685/php-redirect-to-another-page-after-...
1
vote
1answer
52 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
480 views

On form submission how to send 2 email to different users

I have created a custom php form and on its submission email is sent to user but i want to send email to admin as well to keep admin up-to-date about form submissions on website using wp_mail. <...
1
vote
2answers
20 views

test email is working but not sending email with wp mail [closed]

wp_mail($emails, 'New Contact Enquiry | ' . $subject, $message, $headers, $attachments) but getting this error. WP_Error Object ( [errors] => Array ( [2] => Array ( [0] => SMTP Error: data not ...
0
votes
1answer
281 views

Custom user registration fields in user_register hook

I am trying to send an email to administrator with user_register action hook and wp_mail() function when a new user registers. I created some custom registration fields and I want send them via e-mail,...
0
votes
1answer
157 views

wc_mail in foreach loop is sending only the first email

I'm trying to send emails in a foreach loop from a db query and all fine here, but i need to send emails fo each id on the table and only works once, but is not showing any error, seems all fine!. ...
1
vote
1answer
644 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:...
0
votes
1answer
1k views

HTML email sent with wp_mail shows plain text

I have an HTML invoice that I want to send. I use the following function to replace some things in the HTML foreach($variables as $key => $value){ $template = str_replace('{{ '.$key.' }}', $...
4
votes
2answers
13k views

wp_mail script with jQuery post

I need to send an email from a page when a form is submitted. I thought I'd use jQuery post but I'm not really sure where to start. Would I use wp_mail()? And if so how could it be called? Sorry if ...
3
votes
1answer
6k views

Email sent from WordPress has HTML tags

Instead of: Hello, Thank you dfasdfasdfasdf asdf asdf asdfas dfs Please, feelasdf asdf asdf The email that arrives in my mailbox looks like the following: <p>Hello,</p> <p>&...
0
votes
3answers
215 views

Is wp_mail plugin territory?

I recently stumbled upon this and was wondering if calling wp_mail() in a theme is allowed or not as per WordPress standards. I should clarify that I'm not overriding it as a pluggable function in the ...
1
vote
1answer
982 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
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('...
0
votes
3answers
1k views

wp_mail not sending

So I have a localhost WordPress server, and the function wp_mail workd perfectly and sends. When I put the exact same file in an actual WordPress website as a theme, it only shows me a blank screen, ...
1
vote
2answers
480 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
1answer
2k views

Should I use wp_mail or PHP's mail? [duplicate]

I have an email system that I am making in a WordPress plugin to send the emails with this code: include(PLUGIN_DIR.'config/class_phpmailer.php'); $email = new PHPMailer(); $email->From = ...
1
vote
1answer
99 views

WordPress unable to send mail

I am unable to get email functioning in WP 4.8. I have WordPress running on a Bitnami LAMP stack. All modules/plugins/themes/languages are up to date. I have an SMTP host that is effectively an ...
0
votes
1answer
232 views

Send email to admin with post author

I'm using the following to send an email to the admin when a post is publish by an author: add_action('publish_post', 'send_admin_email'); function send_admin_email($post_id){ $to = 'admin@email....
0
votes
1answer
2k views

How to send email from contact page without using a plugin

How can I send an email from a contact page in WordPress without using a plugin? Does WordPress have a default function by which I can send email?
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
1answer
1k views

Send bulk emails without timeout

I am developing a plugin that sends emails out to users. I am having difficulty in finding the most performance enhanced way to send these emails out and prevent a server timeout. In other words, I ...
0
votes
1answer
76 views

New user notification issue

I'm having an issue with our business' website. Every new user that registers on our site will never get an email confirmation which has the randomly generated password. As for us, the admins, we do ...
2
votes
1answer
240 views

Intercepting wp_mail() to view contents

I'm looking for a way to hook into the mail function before it sends so I can var_dump the output. Are there any action hooks with the mail message that I can hook into? I'm having trouble finding the ...
0
votes
1answer
28 views

Allow user to add the php code in wp_mail()

I have an email triggered like below. I want a user to be able to customize the content. I want to provide the user to be able to put esc_html($user->display_name) somehow may some thing with a ...
11
votes
1answer
40k views

Using wp_mail with attachments but no attachments received

I have been looking at multiple examples including this one. I get the email no problem but there are no attachments. Am I missing the content/type of file type? All the examples I've seen uses only ...
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 ...
0
votes
1answer
72 views

Adding a button to send email to a user in WordPress Admin Users table

I would like to add a button for each user in the user page in wordpress admin area that will send an email to that specific user when clicked. The code adds the action link "Send Verification Email" ...
1
vote
1answer
767 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
306 views

How to make a stand-alone button to the post edit view

I'm looking to add an option to my pages that will allow the user to send out notifications that the post has been added to a subscribe list when they click the button. I want the button to be on ...
5
votes
2answers
1k views

Using WordPress templating for HTML emails

I am working on a plugin that needs to send out an email after a form submission. I am using wp_mail() for this and it works fine. My problem is that in my code the HTML is generated by a bunch of ...
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
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', '...
2
votes
3answers
18k views

Include HTML template file in wp_mail

I'm using wp_mail() to send an HTML email. But there's quite a lot of HTML code in the email, so rather than including all the code in my wp_mail() function, is it possible to have the code in a ...
0
votes
1answer
389 views

wp_mail sending old content from post

I have a function that sends out emails using wp_mail() every time a post is published or updated. However, the content that is being sent is always one post behind. If I update the content the email ...
0
votes
2answers
392 views

Send email from Wordpress

What's the best way to send a email from Wordpress after a certain action. I'm working on a site where users can submit ideas and then other users can comment on them. I would like to send emails to ...
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'; ...
0
votes
1answer
4k views

Why is wp_new_user_notification not working?

I don't like to use a plugin so I made use of user registration custom signup page and it's not sending any emails. At first everything was working. Then I added some functions to change the "from" ...
1
vote
1answer
479 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, $...
6
votes
2answers
8k views

Using wp_schedule_single_event with arguments to send email

I'm trying to schedule a pseudo cron job to send an email after a set amount of time utilizing a WordPress plugin. So far, I've been able to make this code run when I hard code the email address and ...
4
votes
1answer
1k views

Using wp_mail() - verify that email was sent?

When using wp_mail(), is there any way to verify that the email was sent correctly?