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
1 vote
0 answers
13 views

wp_mail fails with "Could not instantiate mail function" but "mail()" works fine

I have issues with wordpress emails not being sent. So for testing, I created this code: add_action( 'wp_mail_failed', 'onMailError', 10, 1 ); function onMailError( $wp_error ) { echo &...
uncovery's user avatar
  • 169
0 votes
0 answers
24 views

Using wp_mail to send attachment from a file stream content

I am using wp_mail to send mail with attachment. The attachment is not stored anywhere. The attachment contents are fetched viacurl request. This is what I wrote. This function below (...
sariDon's user avatar
  • 265
0 votes
0 answers
16 views

Send email with a PDF embedded

I am trying to send an email with a PDF embedded in the body of the email. The email gets sent, but the PDF doesn't show up. If I view the source of the email, the code does show the embedded PDF, but ...
Darth Mikey D's user avatar
0 votes
2 answers
68 views

WordPress Bimber template not sending User activation mails automatically

I have a bimber WordPress template, it has a User section in admin panel, when a new user signups, it goes to pending section, waiting for me to send an activation mail. How can I automate this ...
Meric Ozcan's user avatar
0 votes
0 answers
26 views

Edit password change email text or disable it

I have a function in my custom plugin that will be called after the user do the fisrt login. The function, after a check will give to the user the ability to change it's assigned password with a ...
ICTDEV's user avatar
  • 113
0 votes
1 answer
24 views

Wp Redirect Not Working Can u Help

Hey I developed a form in which user will add detial and it will send email to the team using wp mail. Now i have two issue one is i am having redirect issue i want to redirect user to back page after ...
waqas023's user avatar
0 votes
2 answers
178 views

wp_mail - send emails after 24 hours from users registration

I have writed a lugin that will send emails after the user completed a custom registration form. I need to send emails after 24 hours from registration, is this possible by using the wp mail function? ...
ICTDEV's user avatar
  • 113
0 votes
0 answers
21 views

How to get cron name which calls my function

I need to send to users who have birthdays an email with a coupon, and I don't want the emails to be sent in very quick succession. I want to send them in 1 second intervals. I implemented the idea of ...
Vlado's user avatar
  • 111
0 votes
2 answers
67 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 = ...
gerard principe's user avatar
0 votes
0 answers
109 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 ...
LesCa's user avatar
  • 21
3 votes
1 answer
92 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 ...
Gavin's user avatar
  • 384
0 votes
1 answer
44 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 &...
user2841359's user avatar
0 votes
2 answers
404 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: $...
PC Welcome's user avatar
0 votes
0 answers
498 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 ...
Sam's user avatar
  • 1
1 vote
0 answers
61 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 <...
Jan's user avatar
  • 33
0 votes
0 answers
39 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 ...
StevieD's user avatar
  • 211
0 votes
1 answer
155 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. ...
Tony Djukic's user avatar
  • 2,010
0 votes
1 answer
241 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 ...
davidgo's user avatar
  • 212
0 votes
1 answer
279 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 ...
Hylland's user avatar
0 votes
2 answers
979 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 = ...
Rick Hellewell's user avatar
1 vote
1 answer
461 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 ...
Ben de Meillon's user avatar
1 vote
1 answer
267 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','...
user10093863's user avatar
1 vote
0 answers
228 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 ...
Burhan Jivanji's user avatar
0 votes
1 answer
495 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 ...
Soraia Carmo's user avatar
0 votes
1 answer
130 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 ...
wpdev215's user avatar
0 votes
0 answers
118 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: //...
Rohit kc's user avatar
0 votes
1 answer
34 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 ...
C0G1T0's user avatar
  • 105
0 votes
0 answers
294 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 ...
kamil danilski's user avatar
0 votes
0 answers
165 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-...
Marcus Wood's user avatar
0 votes
0 answers
28 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-...
Riccardo's user avatar
  • 931
0 votes
1 answer
99 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), ...
Riccardo's user avatar
  • 931
0 votes
1 answer
189 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 ...
Silvia Malavasi's user avatar
0 votes
0 answers
71 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 ...
imagIne's user avatar
  • 53
0 votes
1 answer
338 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 ...
Game Lover's user avatar
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: $...
tiago calado's user avatar
0 votes
1 answer
97 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
132 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 ...
Brandon's user avatar
1 vote
1 answer
616 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
790 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(){ $...
para_bit's user avatar
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 ...
niki's user avatar
  • 23
-2 votes
1 answer
274 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 ...
juankvillegas's user avatar
0 votes
0 answers
236 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 ...
Thando Hlophe's user avatar
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(); $...
km onur's user avatar
  • 129
0 votes
0 answers
528 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 ...
David Becckam's user avatar
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( ...
user7734861's user avatar
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() ...
davidb3rn's user avatar
0 votes
1 answer
290 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 ...
user191790's user avatar
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, ...
Dhimas Kirana's user avatar
0 votes
0 answers
314 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 ...
Nirmal KUmar's user avatar
1 vote
0 answers
113 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 ...
kalyan's user avatar
  • 153

1
2 3 4 5
7