Wordpress notification based on advanced custom fields data - wordpress

I have posts on my website (custom post type) of which the content is filled from advanced custom fields input. The post also include a date field and an email address field. What I like to do is send automatic notifications to the email address when the date is today. Or even better 3 days before the date of today.
I've read some articles about using Wordpress php mail function but don't know where to start. Any points in the right direction are appreciated.

So you can use the Wordpress wp_mail() function.
https://developer.wordpress.org/reference/functions/wp_mail/
Make sure you are using a SMPT plugin so your email doesn't end up in spam.
https://wordpress.org/plugins/wp-mail-smtp/
That should get you started, not sure how I would set up the job to send the mail, by I would definitely use wp_mail().

Related

Sending emails to multiple recipients using Wordpress contact form

I've questions about create a contact form and sending one mail to multiple recipients.
I am a volunteer in an association and we need to regularly share a mailing list between more than 20 coordinators.
The main problem is that we need to update this list in a regular basis.
Another problem is that you can't send a single mail to more than 100 recipients using mozilla thunderbird (so we reach the mail recipients limit).
I search for a solution to easily have access to this list for each of coordinators.
We have a website so I thought I used it in a clever way to share the said mailing list between coordinators and also be able to update it (add or delete contacts).
I tried those steps:
I created a wordpress page protected by a password, with a simple contact form (using CF7 plugin) using a textarea and a button.
install contact form 7 plugin
create a basic contact form
setting the mailing list (more than 100 mails addresses in Bcc field)
The point here is that the coordinator will write mail and it'll send the mail to the entire mailing list set in the additional headers of Contact Form 7 plugin settings.
I need to test if the mail has been received by everyone.
Another requirement is that i want to be able to send pictures and i need to have a correct text editor.
is there a way to test to send one mail to more than 100 emails adresses without being limited ?
how can i create a large amount of emails addresses for testing ? is there a tool for this ?
In the end, is this the right way to go? Or is there a simpler way to share and update the email list?
I hope I was clear enough.
Thanks in advance.
Ars_n
Wordpress: Version 4.9.11
Contact Form 7: Version 5.1.4
In my experience mailchimp has been super easy to use and very powerful. It seems like it would be able to solve all your problems you mentioned.
Here is the website: https://mailchimp.com/
Here is a plugin for your wordpress site: https://wordpress.org/plugins/mailchimp-for-wp/

Generate Email Coupon Wordpress

This might be off topic question but I would like to ask it anyway to the developers out there.
Is there a plugin or whatever, that can enable automatic single use coupon code delivery to a user on wordpress/page?
Basically WordPress will send an email to the customer and then the user takes an action (clicks button, clicks link from email), and can see a unique, single use, coupon code back to the wordpress site? Each user of course would see a unique coupon code because there would need to have been a list of unique coupon codes selected/uploaded to begin with.
Thanks for your kind answers if there is any. Please.
I am not sure if this is what you are looking for:
YITH WOOCOMMERCE COUPON EMAIL SYSTEM

Wordpress notification custom field

I need to add mail notification on Wordpress.
I've a custom post type with a date custom fields.
When today is the date in custom field for one of the custom post, I need to send mail with all informations from this custom post.
Do you know how I can do this notification ?
Thanks a lot !
You have to create a new function in your WP, in functions.php for example, to scroll through all "custom post type" and compare if the current date is the same as the "custom post type and if so, send the mail (You can use the php mail function).
Then you have to talk to your hosting provider and you have to add in cron this function and that you run it every minute.
I hope it helps you, if you need anything else do not hesitate to ask.

Save custom post fields value before Woocommerce email send

I have an issue regarding emails sent by Woocommerce.
I have multiple custom fields, set up using the ACF plugin, for Wooocomerce orders. These fields contain additional info that should be visible in the emails sent to the user.
But for some reason I can't get them to save before the email is send and thus the email is empty of those values. Only after I click resend email are the values visible.
I tried prioritizing the action hooks using the Prioritize Hooks plugin but to no avail. Tried multiple things in order to prioritize.
I have the Woocommerce emails set up in the template that I use and get retrieve the custom fields like this:
$fields = get_field('fields', $customer_order->ID);
How can I get this to work properly? Any help is appreciated.
you need to store your data before send the email, so you need to find the correct hook.
If i'm not wrong the before_woocommerce_pay hook is your answer check here for more woocommerce hooks

Wordpress - update functions.php from dashboard

I'm sure this isn't possible but I thought I would ask.
In my functions.php file I have a wp_mail function that sends an email to moderators when posts are made.
This email is sent to number of different address - these addresses might change.
I thought it would easier to set these email addresses in the WP Dashboard something like on custom page and then have functions.php update with the new emails.
Is this possible?
Yes, this is possible.
With out getting into the specific coding details you would need to store the different email addresses in the database.
You could tie in advanced custom fields to the wp_mail function to pull the different address from a list. That way you could skip building a page in the dashboard to display the addresses.
Regardless some custom coding would need to happen in the mail function to grab the data from advanced custom fields.

Resources