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
1k views

How to send email with wp_mail() with from email taken from contact form instead of the host?

I have set up SMTL like this, add_action( "phpmailer_init", "send_smtp_email" ); function send_smtp_email( $phpmailer ) { ini_set("sendmail_from","xyz@gmail.com"); ini_set("sendmail_path","xyz@gmail....
0
votes
2answers
2k views

Email always ends up in spam

I created a function which I use to send an email when a specific button is pressed. This works great, except that it always ends up in spam instead of the inbox. This is the function: function ...
0
votes
2answers
1k views

wp_mail() not sending emails with ajax

I am using wp_mail() to send email using ajax. My mail code is as follow. add_action( 'wp_ajax_send_confirmation_email', 'wpse_sendmail' ); add_action( 'wp_ajax_nopriv_send_confirmation_email', '...
2
votes
3answers
815 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 ...
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, ...
0
votes
1answer
1k 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() ...
1
vote
1answer
21 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
1answer
575 views

How to send the checkbox value to email

HTML of form is given below <?php for($i=$start;$i < $end ;++$i) { if($emails[$i]!=""){ $userId=$emails[$i]['...
0
votes
1answer
606 views

Filter wp_mail based on content type

I can current filter the content type of the wp_mail function: add_filter( 'wp_mail_content_type', function( $content_type ) { return 'text/html'; }); And I can filter the message content ...
0
votes
0answers
24 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 ...
2
votes
2answers
11k views

wp_mail() is not working in localhost

I'm trying to test wp_mail() in my local. When I var dump wp_mail,I get Boolean false.This is my code $to = "abcd@gmail.com"; $subject = 'my subject'; $message = 'I would like to work ...
0
votes
0answers
19 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 ...
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 ...
0
votes
3answers
2k views

wp_mail() function doesn't send email in Ajax mode

When I use the wp_mail() or mail() function in AJAX, the function doesn't work and doesn't send email. When I use these functions simply in my functions.php file it works fine. It's not related to ...
0
votes
1answer
2k 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,...
3
votes
3answers
3k 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 ...
0
votes
1answer
875 views

How can I configure an SMTP Server?

I'm trying to follow the instructions here: https://gist.github.com/butlerblog/7e4dbafcbc61b15505ee8ca90510f1e7 But I'm getting confused. I'm not sure what arguments to pass where. Here is what I ...
0
votes
2answers
2k 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']; $...
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 ...
0
votes
1answer
1k views

Send email daily using `wp_mail`

I want to send email daily 12:54pm using wp_mail function, but it send mail continuously. Plz suggest what is wrong? <?php $timeg = date( 'g:ia', current_time( 'timestamp', 0 )); $timem = '12:...
1
vote
0answers
38 views

Has WP 5.7.2 possibly changed the email process, specifically, does anyone know where to find a list of PHPMAILER_EXCEPTION_CODES? [closed]

Been using a Form plugin for several years (forms haven't changed for some time) and up until recently these forms have been fully functional ... specifically ... they are supposed to send both a ...
1
vote
1answer
51 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
1answer
43 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. ...
1
vote
0answers
58 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 ...
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 ...
1
vote
1answer
528 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($...
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 ...
0
votes
2answers
1k views

wp_mail doen't send mails whit attachment

On my site I hava two forms witch send email. The one whit no attachment needed is sent correnctly, but the other ony witch has an attachment does not get sent. I am using SMTP config whit Postman ...
0
votes
1answer
2k views

Generate and send ICS file through WordPress

I'm writing a custom plugin for reservations. I need to generate an .ics file that needs to be sent to a predefined email address. I've tried some library like ZContent iCalendar and a PHP script ...
0
votes
1answer
511 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, ...
1
vote
1answer
84 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
2answers
61 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 ...
0
votes
0answers
12 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)....
-2
votes
1answer
77 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
0answers
11 views

How do I add a BCC field to a WP_MAIL function on Wordpress [duplicate]

I need some help from someone. I managed to get this below code working on sending emails to a certain user role. However, when the emails sends it sends to all 200 people and they can all see each ...
0
votes
0answers
31 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 ...
11
votes
10answers
94k views

WordPress refuses to send mail, "...your host may have disabled the mail() function"

I recently implemented a comment area on my website and tried to get the email notification to work. It doesn't seem to want to send email notifications when new comments are made. Just to see if ...
4
votes
1answer
921 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(); $...
4
votes
6answers
94k views

Check to check if wp_mail is working properly?

I'm trying to use wp_mail (testing on local machine) but no mail is received. The php.ini has smtp_port = 25 set and the php mail() is working so far. how can I check if wp_mail is working what can ...
0
votes
1answer
1k views

Pass return-path additional parameter in wp_mail

Our server is currently automatically setting the return path as {serverusername@serverhostname.tld}. When sending an email in PHP, I can override this by doing the following: $return = '<bounce@...
43
votes
9answers
24k views

Sending multipart (text/html) emails via wp_mail() will likely get your domain banned

Summary Because of a bug in WP Core, sending multipart emails (html/text) with wp_mail() (to reduce chance of emails ending up in spam folders) will ironically result with your domain being blocked ...
1
vote
2answers
2k views

Mail function is not working

My mail function is not working. When I submit form it says mail sent. But not receiving. I tried echo if the mail sent. It is also working. What is the issue here? Anything with mail function ? <?...
0
votes
1answer
3k views

WordPress wp_mail function not working, returns false

I am sending email with the wp_mail() function but it is not working. It is returning false. Also it is not giving any error in the server log. This is my code: $mailResult = false; ...
0
votes
0answers
242 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
0answers
24 views

How do I use my own SMTP server for WP Mail SMTP?

I'm developing a WordPress site on a Microsoft Azure server. I've installed WordPress on this server, and I've also installed the WP Mail SMTP WordPress plugin. I've also installed the SMTP service on ...
0
votes
0answers
22 views

POSTMAN SMTP cannot match TLD against known list

I am using Postman SMTP plugin 2.0.11 I am having problems with sending email through the wp_mail() function. Most of the time it works ok, but sometimes it does not send the email and whips out this ...
0
votes
1answer
769 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( ...
4
votes
1answer
7k views

Adding an Attachment to Contact Form Using wp_mail

Would anyone be kind enough to explain to me how to attach an uploaded file to an email generated using wp_mail? I've built the form but all the questions I can find online refer to attaching a pre-...
1
vote
2answers
1k views

How to retrieve the sender email with wp_mail()?

I Have this simple following code : <?php //if "email" variable is filled out, send email if (isset($_POST['email'])) { //Email information $to = get_option( 'admin_email' ); $headers ...
0
votes
1answer
131 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 ...

1
2 3 4 5
7