Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
0 answers
5 views

Get page permalink in contact form

<?php function leverage_handle_ajax_request() { if ( ! empty( $_POST ) ) { require_once( plugin_dir_path( __FILE__ ) . 'recaptcha.php' ); if ( isset( $_POST['section'] ) &...
user avatar
1 vote
1 answer
27 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 ...
user avatar
0 votes
1 answer
32 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','...
user avatar
1 vote
0 answers
25 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 ...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
1 answer
18 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 ...
user avatar
0 votes
0 answers
61 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: //...
user avatar
0 votes
1 answer
15 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 ...
user avatar
  • 5
0 votes
0 answers
21 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 ...
user avatar
0 votes
0 answers
22 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-...
user avatar
0 votes
0 answers
20 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-...
user avatar
  • 873
0 votes
1 answer
58 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), ...
user avatar
  • 873
0 votes
0 answers
16 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 ...
user avatar
0 votes
1 answer
30 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 ...
user avatar
0 votes
0 answers
29 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 ...
user avatar
0 votes
0 answers
53 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 ...
user avatar
0 votes
0 answers
33 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 ...
user avatar
  • 358
0 votes
0 answers
87 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 ...
user avatar
  • 1
0 votes
1 answer
25 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 ...
user avatar
0 votes
0 answers
32 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 ...
user avatar
1 vote
1 answer
420 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: $...
user avatar
0 votes
0 answers
127 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 ...
user avatar
0 votes
0 answers
30 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 ...
user avatar
  • 23
0 votes
1 answer
46 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. ...
user avatar
0 votes
0 answers
67 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 ...
user avatar
1 vote
1 answer
124 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. ...
user avatar
1 vote
1 answer
213 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(){ $...
user avatar
0 votes
2 answers
274 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 ...
user avatar
  • 23
-2 votes
1 answer
140 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 ...
user avatar
0 votes
0 answers
64 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 ...
user avatar
6 votes
1 answer
2k 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(); $...
user avatar
  • 89
0 votes
0 answers
338 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 ...
user avatar
0 votes
1 answer
1k 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( ...
user avatar
0 votes
1 answer
3k 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() ...
user avatar
0 votes
1 answer
184 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 ...
user avatar
0 votes
1 answer
1k 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, ...
user avatar
0 votes
0 answers
208 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 ...
user avatar
1 vote
0 answers
45 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 ...
user avatar
  • 53
0 votes
2 answers
39 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 ...
user avatar
  • 688
0 votes
0 answers
87 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?
user avatar
0 votes
1 answer
188 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 ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
  • 107
0 votes
1 answer
70 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 ...
user avatar
0 votes
1 answer
277 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 ...
user avatar
0 votes
0 answers
194 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 ...
user avatar
  • 25
0 votes
2 answers
104 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 ...
user avatar
0 votes
1 answer
458 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: <...
user avatar
2 votes
1 answer
144 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 ...
user avatar
2 votes
2 answers
525 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 ...
user avatar
  • 83
2 votes
1 answer
608 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, ...
user avatar

1
2 3 4 5
7