wp_mail() is a wrapper for PHPMailer which is a wrapper for PHP’s mail() function.

learn more… | top users | synonyms

16
votes
3answers
8k 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 ...
7
votes
1answer
1k views

What is the advantage of using wp_mail?

What is the advantage of using wp_mail() over mail(). Codex says they're similar, but they seem to be very similar.
4
votes
2answers
6k views

What's the easiest way to setup SMTP settings 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?
4
votes
1answer
6k 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: $email_to ...
3
votes
2answers
2k views

Using wp_schedule_single_event with arguments to send email

I'm trying to schedule a pseudo cron job to send an email after a set amount of time utilizing a WordPress plugin. So far, I've been able to make this code run when I hard code the email address and ...
3
votes
2answers
539 views

wp_mail function timing out

I have the following function. This is part of a membership-based site. When a post of the type "message" is moved to Publish status, it should send an email to all users who belong (custom user meta) ...
3
votes
1answer
2k views

wp_mail is undefined

I am writing a plugin that opens up a form to invite people to a website by email and want to use wp_mail(). Whenever I use the wp_mail() function in any file in my plugin folder I always end up ...
3
votes
1answer
618 views

How do I override the Message-ID header of wp_mail function?

I have a custom notification function for our comments editor, who prefers to have all comments from one article threaded together in her email client. To achieve this, I'm creating a custom ...
3
votes
1answer
4k views

Using wp_mail with attachments but no attachments received

Ok I give up. Been looking at multiple examples including this one. I get the email no problem but there are no attachments. Am I missing the content/type of file type? All the examples I've seen ...
3
votes
1answer
293 views

Different wp_mail_from and wp_mail_from_name for specific situations

I'm wondering how to create differents wp_mail_from and wp_mail_from_name for specific actions that use the built-in mail system in Wordpress. For example, when a new comment comes, notify the user ...
3
votes
1answer
3k views

wp_mail and BCC headers

I'm using WP 3.3.1 I am trying to add BCC onto the headers of an email I'm sending out, but the BCC is not being added. public $from = "sender@example.com"; public $replyTo = "sender@example.com"; ...
2
votes
4answers
10k 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 functionality to work. It doesn't seem to want to send email notifications when new comments are made. Just ...
2
votes
1answer
253 views

Joining confirmation email

When a super admin adds a network user to a blog via wp-admin/user-new.php where does that confirmation email come from? How do I change? It says incorrectly comes from Wordpress@example.com ...
2
votes
1answer
471 views

Using wp_mail - verify that email was sent?

When using wp_mail, is there any way to verify that the email was sent correctly?
2
votes
1answer
293 views

Pluggable function and activation check?

Plugin is defining pluggable wp_mail() function. My idea was to check if function is defined already and throw warning if other plugin beat me to it. However this warning causes issues on activation. ...
1
vote
2answers
2k views

wp_mail script with jquery post

need to send an email from a page when a form is submitted. Thought i'd use jquery post but not really sure where to start. Would i use wp_mail? And if so how could it be called ? Sorry if that ...
1
vote
1answer
126 views

Email sent from WordPress has html tags

Instead of: Hello, Thank you dfasdfasdfasdf asdf asdf asdfas dfs Please, feelasdf asdf asdf I am getting something like this in the email that arrives to my mailbox: <p>Hello,</p> ...
1
vote
2answers
410 views

wp_mail - Remove sitename from email subject

Can some one tell me how to remove site name from email subject. As of now my email subject looks like this [sitename] - Subject goes here I want it to look like this Subject goes here I ...
1
vote
3answers
2k views

Need clarification on how to correctly call wp_mail()

I want to call wp_mail() from a non-template php file, but when I do so it fails and I don't understand why. For example, let's say I have a php file that consists of only this: <?php echo ...
1
vote
2answers
631 views

If new comment posted in custom post - send notification to custom email from custom field

I have custom post type "Art masters". Each post is master's profile. In their profiles isset custom fiels name "master_email". I need to send for master email notification every time if new ...
1
vote
2answers
740 views

Adding second Email address for WP user notifications

The WP systems sends a lot of mails to authors. There also plugins who use email notifications for authors. But, let say I have a user, who is managed by two persons (because it's a company, an ...
1
vote
1answer
75 views

Email all subscribers when i do an action

I've created this function: function email_subscribed_users($event) { $users = get_users('role=subscriber'); foreach ($users as $user) { $accepted = get_user_meta($user->ID, ...
1
vote
1answer
839 views

Mail not sent when I set HTML headers

$subject = get_the_title(); $sender_name = get_bloginfo('name'); $blog_url = get_bloginfo('url'); $to = 'myemail@mydomainname.com'; $subject = 'the subject'; $message = 'hello'; $headers = ...
1
vote
1answer
1k views

Fatal error: Call to undefined function wp_mail()

I am using a plugin wordpress-simple-paypal-shopping-cart for my cart requirement. I am trying to send an email through this plugin when some payment is made by using IPN. My code : $invoiceProducts ...
1
vote
1answer
58 views

Unable to override pluggable function wp_mail

A couple of days ago, my wordpress blog hosted on openshift suddenly stopped sending me mails and notifications. Until now I'd never bothered how wordpress handled mail sending since they always ...
1
vote
1answer
483 views

Error when requesting password reset email - wp authentication

I get the following error whenever a user tries to request a password reset email: The e-mail could not be sent. Possible reason: your host may have disabled the mail() function. As per ...
1
vote
1answer
643 views

Email notification via WP_Mail on published custom post type

I've been trying to get an email notification to fire when a new custom post type (in this case, "event"), is published. I've tried a few things and settled down to this simple example that, I ...
1
vote
1answer
222 views

3 different mail notifications

I'm building a small tracker and need to send mail notifications on specific actions. Thought-out notifications: Administrator gets a notification email when a new ticket is published Author gets a ...
1
vote
1answer
870 views

Do I have to override the wp_mail() pluggable function with writing a plugin?

If I want to override wp_password_change_notification, do I have to write a plugin to do this? It seems to have no effect in functions.php of my theme. The only thing I need to do is change the ...
1
vote
1answer
2k views

wp_mail not recognizing cc and bcc headers

I am using WordPress 3.1.3 I am getting following notices when I use wp_mail with cc and bcc headers. Notice: Undefined variable: cc in ...
1
vote
1answer
42 views

wp_mail file attachment not being placed in upload folder?

I have a form where I want users to be able to select an image to upload. The image gets temporarily uploaded to the wp-content/uploads folder, is attached to the e-mail and then is destroyed. Right ...
1
vote
0answers
24 views

wp_mail isn't making the from header correctly

So I've got a couple of different plugins which I'm attempting to change the from address of the email header. I've tried using the filters, but it's simply sending the email as the admin user ...
1
vote
1answer
53 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 ? ...
1
vote
0answers
25 views

Using wp_schedule_event to send emails including links

I'm trying to write a simple plugin using wp_schedule_event to send emails. The first example below works fine, but in the second (where I try to include a url within the email) nothing happens. Why? ...
1
vote
0answers
45 views

Trying to get author'email for sending email from single.php page in wordpress?

I am trying to get author's email in order to send a email form single.php page in WordPress. Actually I would like to get output in quotes in order to send email with wp_mail function. Right?? Here ...
1
vote
1answer
39 views

Website needs to be opened for wp_mail to work

I have a custom post type Events. In that post type, I can schedule events with a date and time. Whenever I publish an event, it will automatically send an email to the users 2 days before the event. ...
1
vote
2answers
102 views

Why is my get_post_meta always empty

I made this action hook which will send an email to the users every time a new post in the custom post type "events" is made. function email_members($post_id) { global $wpdb; $usersarray = ...
1
vote
0answers
115 views

Google Apps SMTP for WP MultiSite?

How can you force WordPress MultiSite to send all emails via a Google Apps SMTP server? I have attempted to use Easy WP SMPTP, however that does not work exactly as I'd hoped, not to mention it fails ...
1
vote
0answers
178 views

wp_mail works with add_action('save_post', …) but not an ajax action

I have two actions. One is after saving a post, so add_action('save_post', 'on_any_post'); I have a second action triggered via AJAX, so add_action( 'wp_ajax_nopriv_saveTaskPriority', ...
0
votes
4answers
1k views

How to stop the wp_mail function?

I'm using wp_mail filter function. add_filter('wp_mail','check_the_mail_content'); If my condition satisfied then the mail should go, otherwise I need to stop, my function is ...
0
votes
1answer
379 views

wp_mail very slow

I have a question about the wp_mail() function. Right now I'm having the following button to send e-mail with: echo '<input type="submit" name="send_button" value="verzenden" id="'.$post_id.'" ...
0
votes
1answer
126 views

Help with filter for wp_notify_moderator()

I have a case where I have multiple Administrators. Not all of them want to be notified per email when there was a comment posted or is held for moderation. The Settings > Discussion page only ...
0
votes
2answers
1k views

Include HTML template file in wp mail

I'm using wp mail to send an html email. But there's quite a lot of html code in the email, so rather than including all the code in my wp mail function, is it possible to have the code in a separate ...
0
votes
1answer
191 views

Change Mail from and display name with a filter action

I'm attempting to override the from display name and email address using wp_mail function. I am using the hook to modify wp_mail_from with my custom function using ...
0
votes
1answer
250 views

Validate emails in array using foreach

How do I validate an array of emails from a textbox before sending them to the wp_mail function? $emails = 'test@test.com;test2@test2.com email3@email3.com,email4@email4.com, email5.com'; $emails = ...
0
votes
1answer
364 views

wp_mail - using a custom field value for $to

I'm trying to pass a custom field value to my functions.php file. I want to replace: $to = get_bloginfo( 'admin_email' ); to something along the lines of: $to = get_custom_field('sendto', TRUE); ...
0
votes
1answer
260 views

If/elseif statement within wp_mail function

I need to know what is wrong with my if statement here: //EMAIL ADMIN BASED ON PROBLEM_TYPE function new_post_creation_email() { global $post; $postid = $post->ID; $problem_type = ...
0
votes
1answer
2k views

resend user login & password with custom button

How would you resend the login & password to a user who has forgotten his password? In this case they don't want to go to the "password" forgotten page. Additional Q: Mass re-sending of ...
0
votes
1answer
47 views

wp_mail bcc admin

I've this code and he does exactly what i want but i want to add the username of the author of the post. // BCC Admin if (get_option('jr_bcc_apply_emails')=='yes') : ...
0
votes
1answer
33 views

Remove from “Wordpress” when reciving email (Should I remove filter?)

I am getting "Wordpress" when I sending my email using wp_mail. So to remove "Wordpress" from my e-mail I am using filter like so: //Remove "Wordpress" when receiving email function ...