Questions tagged [wp-mail]
wp_mail() is a wrapper for PHPMailer which is a wrapper for PHP’s mail() function.
335
questions
0
votes
2
answers
25
views
wp_mail() return false . waiting for response please or suggestions ou recommandations?
public function send_newsletter()
{
global $wpdb;
$recipients = $wpdb->get_results("SELECT email FROM {$wpdb->prefix}zero_newsletter_email");
$object = ...
0
votes
0
answers
88
views
Send summary email from a form with wp_mail
I'm trying to send two emails (one to the site manager and one to the user) with the data entered in a contact form made by me and placed in a wordpress template, but this doesn't work.
i am using ...
3
votes
1
answer
69
views
Filter "wp_mail" - How to distinguish between a WordPress system email and a plugin email?
Using the wp_mail filter I add a "Reply-To" to the header with my email address, so clients can reply directly to the email to contact me if there's any issues. I only want this on WordPress ...
0
votes
1
answer
18
views
All uploaded files using wp_mail() renamed to tmp_name
I am attempting to retain the original file name of my uploaded file using wp_handle_upload() and wp_mail().
Currently, all files are retaining their original file extension, but renaming themselves &...
0
votes
2
answers
175
views
wp_mail attachment not working in wordpress
wp_mail attachment not working, when the form is filled with an attachment the email is sent but with no attachment received.
in wp_mail documentation they said t should add something like that:
$...
0
votes
0
answers
346
views
Word press - JSPDF - Sending PDF as attachment from wp_mail - Special characters
This is my very first post. Thanks to all your answers on other posts.
Am using JSPDF to send an attachment through AJAX call to PHP server- A mail is sent from here with the generated PDF as ...
1
vote
0
answers
55
views
Cc header in wp_mail() not working
for some reason, the Cc email address won't receive the same mail as the recipient.
$headers = array(
'Content-Type: text/html; charset=UTF-8',
'Cc: [email protected]',
'From: IFHC <...
0
votes
0
answers
29
views
Not getting expected email when running cron hook
I'm following the tutorial at https://wpshout.com/wp_schedule_event-examples/
I want to ensure my cron job works and is run at approximately a certain time of day. I have inserted debug code to send ...
0
votes
1
answer
97
views
Working function() doesn't execute when triggered by WP CRON
I've built the following before and have referenced my own code to see if I missed anything and from what I can tell I have not.
I have a WP CRON scheduled and it executes as the scheduled intervals. ...
0
votes
1
answer
145
views
Why does Wordpress not send password reset emails from the Administrator Address?
TIL that, by default, that Wordpress does not use the Administrator Email address to send password reset emails.
Is there a known/accepted reason why Wordpress behaves this way? (It does not seem ...
0
votes
0
answers
114
views
WordPress Custom wp mail template return full template
I am developing simple listing website, and in the listing post i have single page where i displayed some of data and Extra i have added custom form. The form is submitted successfully but when i try ...
0
votes
1
answer
225
views
wp_mail sending only once inside foreach loop
I have written and re-written this code several times. I've tried removing the wp_mail function from the loop and putting it in it's own function. I've moved all the variables in to the loop. At one ...
0
votes
2
answers
641
views
wp_mail vs mail functions and header arrays
I've been having issues using wp_mail and mail functions in an application when specifying header elements in the function.
I usually set up the header as an associative array, as in
$mailheader = ...
1
vote
1
answer
369
views
Send email button in custom post type backend
I've added a button in the backend of my custom post type editor.
I want to send an email using wp_mail() when admin user click a button.
I've added this custom form and button to a meta box. See ...
0
votes
1
answer
179
views
How to disable wp_mail for all users except for admins?
I am using the following code to disable wp_mail however how do I disable it only for non-admins. Any user with admin privileges should still receive their emails.
add_filter('wp_mail','...
1
vote
0
answers
207
views
How to send bulk messages using wp mail function?
I was working in custom plugin development. I have created customer table in woocommerce and create form to reminder customer for new offers. I am using wp mail function to send multiple email to ...
0
votes
1
answer
395
views
How to disable activation email to specific user role?
I'm using Ultimate Member to manage my user roles. I have the Activation Emails active and it sends to new subscribers as expected. But when a user with role "Employee" subscribes, I don't ...
0
votes
1
answer
123
views
wp_mail Allow Remote Attachments from CDN
I came across a problem with WP_Mail for sending form submissions with file attachments. Our site uses a CDN, so everything uploaded to the site, whether images and media by site builders or documents ...
0
votes
0
answers
104
views
Using wp_mail to send email?
I have certain instances where I want to send emails to both user and admin accordingly using wp_mail.
The first instance is when a new user is created.
The following code is used to create users:
//...
0
votes
1
answer
32
views
Email alert with wp_cron and wp_mail if new data (external API) - Pseudo code
I would like to check twice daily if there is some new data published and send me an email if this is the case.
In pseudo code here what I thought I could do:
Get new list of movies (external API ...
0
votes
0
answers
181
views
How to properly use wp_mail() in my own plugin?
I have advanced work on my Wordpress plugin, now I need to add wp_mail(). I read this tutorial https://www.sitepoint.com/build-your-own-wordpress-contact-form-plugin-in-5-minutes/ and this tutorial ...
0
votes
0
answers
102
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
0
answers
24
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
1
answer
96
views
Using WP_Mail on MacOS 12 (Monterey - M1) [closed]
On a brand new Macbook running Monterey (M1), as PHP was removed by Apple on OS 12, I have removed all "AMP" preinstalled by Apple and installed HomeBrew "AMP" (with PHP 7.4), ...
0
votes
1
answer
180
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
0
answers
44
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
1
answer
240
views
wp-mail attachment is not sent for no reason?
I'm using wp-mail to send an image. The problem is that it does not attach the image !
Here is $attachment_img string : https://example.com/wp-content/uploads/2021/10/example.jpg So the path is ...
1
vote
1
answer
1k
views
how to send an email with wp_mail with an image on the email body
I can send emails using wp_mail, however any image on the body will not be display on the email received.
Is there any way of sending an image within the message
this is the code used to send emails:
$...
0
votes
1
answer
71
views
How can I send the mail once?
I am working on a marketplace plugin. If the vendors do not accept the order within the date range I set, the order will be cancelled. For this, I have determined a time period of order date +3 days. ...
0
votes
0
answers
121
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 ...
1
vote
1
answer
479
views
How Can I Change Default Reply ToEmail
I want to set the SMTP settings manually instead of using a plugin. I did this using this resource. However, there is a problem.
If the user clicks "Reply", a different e-mail appears. ...
1
vote
1
answer
682
views
PHP 8, AJAX mail form to function.php doesn't work
I have code that send message to email, it works at PHP 7.2, but after we changed version to PHP 8 it didn't works. Maybe someone have ideas whats wrong?
Function.php
function true_add_ajaxform(){
$...
0
votes
2
answers
1k
views
Change the Sender(not From) on wp_mail() function [closed]
I'm using the Post SMTP Plugin, but I manually send email via the wp_mail() function.
The gmail client shows the correct From:, but when I switch to outlook or another email client, shows the ...
-2
votes
1
answer
249
views
WordPress is not sending the 2nd email in the same request
When I try to send more than one email message in the same request, only de 1st message is sent, the rest of the messages are blocked with the error "Message body empty".
The following code ...
0
votes
0
answers
197
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 ...
7
votes
1
answer
5k
views
WordPress "phpmailer_init" not working for me
I add the following code to the functions.php file.
add_action( 'phpmailer_init', 'my_phpmailer_example' );
function my_phpmailer_example( $phpmailer ) {
$phpmailer->isSMTP();
$...
0
votes
0
answers
487
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
1
answer
2k
views
Attach pdf from dynamic url
When I save a custom post, I would like to send a PDF by email as attachment.
I tried that :
function my_custom_save_post( $post_id, $post, $update ) {
if( ! $update ) { return; }
if( ...
0
votes
1
answer
7k
views
Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
I am trying to make a email template for my wordpress site. So I tried to include the HTML mockup that was given to me, but instead of putting it directly on the same file, I would like to include() ...
0
votes
1
answer
266
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
1
answer
2k
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
0
answers
292
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 ...
1
vote
0
answers
96
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 ...
0
votes
2
answers
52
views
Notify users only on post publish
I am using this function to notify users when their post is published. However, repeated emails are being sent when the post is updated. I only want to send 1 email when the post is published first ...
0
votes
0
answers
120
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
1
answer
294
views
What is the best way to send out thousands of emails from a WordPress site? [closed]
We are currently using SendGrid API to send transactional emails. This is very slow and it freezes the process. How do you send out 5000+ emails on a WordPress site?
We are currently using SendGrid ...
1
vote
1
answer
2k
views
Wordpress email could not be sent
I have faced an error while forgetting email password in WordPress
link : /wp-login.php?action=lostpassword
After submitting email faced below errors:
ERROR: The email could not be sent. Your site ...
0
votes
1
answer
225
views
Pass Variables or Variable Place-Holder from Editor to PHP
I'm building a method for my client to construct a message content to be sent with wp_mail. Within that I'd like them to be able to choose variables, for example the message might look like this in my ...
0
votes
1
answer
404
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
0
answers
221
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 ...