Questions tagged [wp-mail]

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

101 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
154 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. ...
3
votes
1answer
2k views

How to allow specific extensions and file size to wp_mail attachment?

I am trying to create a form with an attachment option that will be sent to an email when the form is submitted on a wordpress site. My codes work fine and it sends email in a HTMKL table format to ...
2
votes
0answers
975 views

Using wp_mail() function outside of WordPress and through PHP CLI

I am developing a simple PHP script that will send emails to users. The script is located outside of WP directory and its run through a cronjob. Example cron job call: php /PATH/TO/SCIRPT/script.php &...
2
votes
0answers
279 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
2k 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
3k 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
204 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
860 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
0answers
42 views

Unable to send custom welcome email after user register

I am trying to send a custom welcome email after user register on our website. The default role set is 'subscriber'. The email should pull some user meta values and display the same in the email. I ...
1
vote
0answers
35 views

Multisite not using subdomains as hostname in from address when sending emails

I have a Multisite installation where I'm facing somekind of bug relating the hostname used when WordPress sends emails (I've test it with WordPress admin emails and Contact Form 7). For example, if ...
1
vote
3answers
1k views

How to do string attachment with wp_mail

I'm using a gift card plugin for my woocommerce shop and I would like to add a generated pdf file to allow customers to download the gift card as a pdf. The idea is to use TCpdf or Fpdf to generate ...
1
vote
1answer
461 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 ...
1
vote
0answers
722 views

wp_mail() headers multipart/alternative

I am trying to send email via wp_mail() containing both plain text, as well as HTML body. When I am setting up headers like this: $headers = "MIME-Version: 1.0 \r\n"; //$headers .= "From: Dawid ...
1
vote
0answers
419 views

wp_mail attachment woes!

Evening all, Been banging my head for hours, tried a dozen posts about this but still can't get my image to arrive my email!! My form contains this... <input type="file" name="file" id="file">...
1
vote
1answer
2k views

wp_mail() not sending email in multisite subdomain

I have a multisite enabled WordPress configuration. My main domain is like http://www.example.com, with several subdomains like http://test1.example.com, http://test2.example.com, and so on. I have ...
1
vote
0answers
296 views

Wp mail does not work when Ajaxed to

I tried to including wp-load, but the wp mail refuses to work when it is called from an ajax hooked function. How can I work around this? Also, on another note, the parameters I sent through AJAX to ...
1
vote
0answers
407 views

wp_mail 200 response but no mail sent

I'm trying to send email from WP using ajax to validate the form and wp_mail to send the mail. The form is a basic form with id names on the fields The js validtion looks like this $(function(){...
1
vote
1answer
568 views

wp_mail() inside AJAX handler never returns

We have an AJAX handler called by jQuery.ajax() that takes a document stored on the server and mails it to the user. At the bottom there is a call to wp_mail like so: $status_wpmail = wp_mail($...
1
vote
1answer
35 views

Emailing passwords: Setup installed on home server using XAMPP

I've just delved into the WP world and all in all it's going quite well. I have a server at home that I'm using to host the sites. All is working fine except the password emails are not being sent ...
1
vote
0answers
416 views

wp_mail not sending when attachment

I'm searching for an hour and my problem is this : I have the following code : //This is an absolute path $attachments = array( $path ); $headers = 'From: My Name <'.$email_expediteur.'>' . ...
1
vote
0answers
355 views

How can I replace Email addresses with BitMessage Addresses througout wordpress?

BitMessage (bitmessage.org) is a peer-to-peer email system kind of based on BitTorrent. By itself, this software and its' messages are not compatible with email, so in order to send an email to a ...
1
vote
0answers
96 views

Trying to get author'email for sending email from single.php page in wordpress?

I am trying to get author's email in order to send a email form single.php page in WordPress. Actually I would like to get output in quotes in order to send email with wp_mail function. Right?? Here ...
1
vote
0answers
423 views

Google Apps SMTP for WP MultiSite?

How can you force WordPress MultiSite to send all emails via a Google Apps SMTP server? I have attempted to use Easy WP SMPTP, however that does not work exactly as I'd hoped, not to mention it fails ...
1
vote
0answers
478 views

wp_mail works with add_action('save_post', ...) but not an ajax action

I have two actions. One is after saving a post, so add_action('save_post', 'on_any_post'); I have a second action triggered via AJAX, so add_action( 'wp_ajax_nopriv_saveTaskPriority', '...
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
0answers
15 views

Using SMTP Function instead of Plugin (functions.php)

While this works just fine, I am concerned that it poses a security threat. Does it? add_action( 'phpmailer_init', 'send_email_using_smtp' ); function bsend_email_using_smtp( $phpmailer ) { $phpmailer-...
0
votes
0answers
17 views

Wordpress doesn't work properly with non standard domain names - PHPMailer fails when initialising

While debugging Wordpress password reset functionality in a test environment on a local macbook, Wordpress would get stuck when sending emails. Basically, before sending emails, a check is done in wp-...
0
votes
0answers
9 views

Wordpress woocommerce new order email not working

I am using woocommerce thank you page hook to trigger functionality for a custom task and in that function I have used 2 wp_mail() methods to send custom mails. This is all working good, However when ...
0
votes
1answer
15 views

Add Server Side validation in Ajax mail form

I'm building a form that takes fields values and send them via wp_mail to the post author. It works, but I want to add a server side validation to improve security. I don't know where to add my ...
0
votes
0answers
23 views

How to send automatic response after form submission without plugin

I create an ajax form and I well received the email. Now, I just want to do like CF7, send an automatic response to the sender to notify him that I well received the form. Which function used or which ...
0
votes
0answers
24 views

comment_post (if comment is approved OR $comment_approved === 1) not working?

I am working on a code through which I can send emails to the user when his/her comments get approved. then I get to know about comment_post. but it is not working. comment_post is working for the ...
0
votes
0answers
27 views

Using two different outgoing email services, can it be done?

Is there any way I can make Wordpress use more than one outgoing email service, and have all emails from a particular plug-in (such as WooCommerce, for example) use one system, and everything else on ...
0
votes
0answers
22 views

How can admins to be notified of changes when users change their WP profiles?

I'm using the code below that I found in another thread. When a user makes changes to their profile, this snippet sends an email notification that something has been changed. I'd like to amend this so ...
0
votes
0answers
18 views

Sending email through Ajax without page refresh hangs on admin_ajax.php

I have this test page on a website - https://piclits.com/test-slideshow/ It displays a bunch of images/PICLITS and grabs them randomly from a folder 12 at a time into a slideshow. I want to email the ...
0
votes
0answers
44 views

wp_mail email sends twice

I created a button on a User's page. It sends an alert email to the admin. It was sending the same email to me 5 times... but I have made some changes. Now it is sending the same email twice. I have ...
0
votes
0answers
21 views

get_post_meta always empty in 'publish_post'

i'm trying to get values from 'get_user_meta' and 'get_post_meta' while sending an notification Mail with the action 'publish_post'. All of my needed variables are empty. But why? function ...
0
votes
0answers
63 views

Running SMTP Conditionally

I'm working on developing a support website and I'm using Gravity Forms to handle the support ticket form. I have the form notification configured so that the "From" shows my client's email ...
0
votes
0answers
16 views

Email 'Magic Link' to Access Content (not login)

I'm developing a site where users have their own 'profile' pages but which won't be public. I have a redirect in place currently which sends the visiting user away if not logged in (and not the owner)....
0
votes
0answers
47 views

Wordpress wp_mail function crashing website

So i've been trying to send email from my functions.php script. When wp_mail function is fired, my entire website crashes. I have enabled all the error display settings in wp-config. I literally ...
0
votes
0answers
285 views

Updated : how to make email optional while user registration using default wordpress form

I wonder if there is any way to make email an optional field while registering using default form. So that those who don't know mail may leave it blank. I got code from stackexchange but that doesn't ...
0
votes
1answer
156 views

wp_mail only sends emails to gmail

wp_mail only sends emails to gmail and i receive emails only on gmail inbox but in dedicated servers couldnt send recieve anything even as spam followed data works well only to gmail ...
0
votes
1answer
733 views

wp_mail send multiple emails in a loop

I'm very confused with wp_mail(). Here my code. function email_notification_for_admin_and_customer( $order_data ) { $subject_email = 'Subject LOREM IPSUM'; $customer_email = 'Hi Customer, ...
0
votes
0answers
182 views

How to send a particular csv file as an email?

I have created a function to run a query and create a CSV file. The CSV file will be stored in a particular folder on my server. These files are distinguished by dates. I want to schedule an event ...
0
votes
0answers
76 views

Faster Emails with WP Mail

I'm using wp_mail() to send transactional emails on my website, but it takes very long to process the email. What can I do to speed up this process?
0
votes
1answer
242 views

wp_mail function not working in WordPress Plugin Boilerplate

I am creating a plugin using WordPress plugin boilerplate (https://wppb.me/), I have create a separate file for sending emails under /admin/partials/ directory. but wordpress throw error when I am ...
0
votes
0answers
170 views

Sending bulk mail to a certain number of users

We would like to send bulk mail to the user list using wp_mail() function. Is it possible to send e-mail to users at a certain time (similar to newsletter plugins)? For example, dividing the list of ...
0
votes
2answers
83 views

Including user data in "new user notification email"

I'm trying to create a function that sends an email to the admin when a new user registers. I would like the email to contain the users first name, last name, email address, and billing information ...
0
votes
1answer
299 views

Can't change headers / From for wp_mail()

i tried nearly anything to change the From / Reply-to name for the wp_mail() function. Here is my code: $headers = "From: \"FROM NAME\" <from-mail@from.com>\n"; $headers .= "Return-Path: <...
0
votes
1answer
145 views

Send a email base on a taxonomy term

I like to have a email send if a custom post is created/updated if it has custom taxonomy term. The here is the CPT, taxonomy and term. Custom Post Type: Call Custom taxonomy: call_type Custom ...
0
votes
0answers
64 views

Contact form with file upload

I'm trying to create a contact form that lets users upload files. This is the PHP code I have: function ajax_contactform_action_callback() { $error = ''; $status = 'error'; if (empty($_POST['name']...