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
879 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
877 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
2answers
717 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 ...
3
votes
1answer
1k views

Postman: wp_mail has been declared by another plugin or theme

I need use Postman for sending email using an SMTP server, but when installed, it shows this message: Postman: wp_mail has been declared by another plugin or theme, so you won't be able to use ...
0
votes
1answer
1k views

Problem using wp_mail function

I have a form whose message is composed from multiple input fields when submitted. I got this form working as simple php document but when I'm trying to use the form within a wordpress page it doesn't ...
0
votes
1answer
1k views

wp_mail encode ’ in ’ in subject

I create a function to send mail (in french) for custom post, it's work but subject is encoding in html. I do this : $get_title = get_the_title($ID); wp_mail("me@my.com","new article : ".$get_title,"...
0
votes
2answers
522 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', '...
3
votes
1answer
1k 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 ...
3
votes
2answers
165 views

How to set up gmail SMTP in Wordpress

I'm trying to set up an SMTP gmail server to send emails from my WordPress site. This is what I've got in my wp-config.php: define( 'SMTP_USER', 'myaddress@gmail.com' ); // Username to use for ...
1
vote
1answer
672 views

wp_mail not sending attachment

My mail function is as follows add_action('wp_ajax_order_processing', 'order_processing'); function order_processing(){ include 'mail-translations.php'; require_once( ABSPATH . 'wp-admin/includes/...
18
votes
3answers
41k views

How to set SMTP programmatically

Assume we have blank WP site and we want to setup SMTP settings programmatically in our plugin or theme. What's the easiest way to do it without changing core files?
2
votes
2answers
1k 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
0answers
13 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 ...
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
2answers
35 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
544 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; ...
9
votes
9answers
84k 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 ...
2
votes
1answer
157 views

Send automatic emails to multiple user roles when a custom field is updated in a custom post type

I'm trying to incorporate a 'Register interest' button into a website which when signing up will assign register the user to a user role and then when a custom field is updated in the property (CPT) ...
2
votes
1answer
57 views

WordPress is executing URL in code when called via wp_mail()

I have written a custom plugin (that creates a custom post type) and allows any user to submit a new post from a form on my website. To prevent bots, I have setup an e-mail confirmation code which ...
0
votes
1answer
250 views

wp_mail sends email twice inside function updated_postmeta

I made a custom function so when postmeta updated to a specific value I send custom email use wp_mail(). Email sends successfully, but it creates two at the same time. Here my code: function ...
0
votes
1answer
24 views

wp_mail doesnt work inside transition_comment_status

I need to send a notification for a visitor whose comment has been published. I created this function to do it: /************************************************* ** COMMENT APPROVED HOOK ************...
0
votes
0answers
402 views

Send data URL string as an attachment in wp_email

We have a data URL string of PNG image file here and we can pass it via AJAX to a PHP function via button click. Now is it possible to convert it back as image file and add as an attachment to ...
2
votes
2answers
79 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 ...
1
vote
2answers
54 views

Restrict current user from receiving email using wp_mail

I have created a code through which the current user can add other users to his project. These users are only shown on the project page. They will not have any right to modify the project. Once these ...
0
votes
0answers
50 views

Mail not working on WordPress site

Mail is configured and is working on other sites in localhost but I am not able to find the problem with current WordPress project I am working on. I tested using WP Mail SMTP plugin also but it's ...
0
votes
1answer
26 views

Add multiple recipients via BCC on wp_mail()

I created a function which returns an array of email addresses: // returns all wanted email adresses leweb_get_events_detail(); This is the given array: Array ( [0] => mail@example.com [...
0
votes
1answer
66 views

Sending mails with wp_mail() to multiple recipients using wp_cron and dynamic email body data

I have a frontend submission form, where users can add events to a custom post type. I want to send an email to each user 1 week before this event takes place. The emails are sent via wp_cron. The ...
33
votes
5answers
31k views

Why won't wp_mail() let me set the From: header when plain old PHP mail() will?

When I use wp_mail( $to, $subject, $message, $headers ) (with values in place, of course), the email gets sent with a from name and email that isn't set anywhere I can find (not even in PHP or Apache ...
37
votes
7answers
18k 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 ...
44
votes
4answers
80k views

Is there a way to send HTML formatted emails with WordPress' wp_mail() function?

Is there an action_hook or something similar that could help me achieve this? I tried adding markup in a PHP string variable and just fired off an email with the wp_mail() function like so: $...
0
votes
1answer
26 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
108 views

WP Mail plugin not sending the mail

the plugin WP Mail SMTP v1.4.2 logged this error during the last time it tried to send an email: Mailer: Default (none) PHPMailer was able to connect to SMTP server but failed while trying to send an ...
1
vote
0answers
446 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
575 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
1answer
40 views

User invite email not delivered - related to subdomain?

I have a problem where, on a new install of WordPress, I want to add a new user, but the user is not receiving the email with the confirmation link. I've done some research and understand that this ...
2
votes
1answer
29 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 ...
0
votes
2answers
318 views

Cron not sending wp-mail()

I have a problem with a cron schedule function, it does not want to send an email with the wp_mail() function. This is my code: It is placed in the functions.php <?php add_filter('...
2
votes
1answer
27 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 ...
1
vote
1answer
26 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, ...
0
votes
1answer
25 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
2answers
1k views

WordPress Ajax JSON success return no being recognized

I'm working on a contact form for a website using an jQuery Ajax call method that then uses WordPress's building in admin-ajax.php to submit the form's values, send them to an email address via ...
0
votes
0answers
43 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']...
0
votes
2answers
898 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
163 views

How to use PHPmailer in a function in WordPress

I have a function in the WordPress functions.php file that searches for a condition in user meta and sends an email to a user based on what it finds. I currently use wp_mail() to send the email, and ...
0
votes
2answers
1k 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']; $...
0
votes
1answer
1k 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
732 views

Could not get attachment using wp_mail

I am trying to create a form which can be sent by users with an attachment. The form works fine and sending the emails when it is submitted but without the attached file. my form is : <form ...
0
votes
1answer
901 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
3answers
8k views

wp_mail attachment not working

Hello I am trying to send mail with some attachment using with wordpress wp_mail functionality but I am not getting attachment in my mailbox. Can you please check my bellow code and guide me where I ...
2
votes
2answers
416 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 ...