WordPress Ajax JSON success return no being recognized

You are not giving the action name to your AJAX call. In WordPress, you have to give an action name, the same name you give whatever is after wp_ajax_ and wp_ajax_nopriv_ In this case, the AJAX call should work if you change the data: inside your AJAX call, for this: data: {action: “contactform_action”, values: $(‘#contact-form’).serialize()} … Read more

Sending emails to separate accounts using a for loop

For whatever reason, this part: for ($z = 1; $z <= $Number_of_Categories; $z++) is the offender. even though $Number_of_Categories was defined above where it is used, the value wasn’t holding. I had to build a function instead, and do this: function get_Number_of_Categories(){ return “2”; } for ($z = 1; $z <= get_Number_of_Categories(); $z++) once I … Read more

Wp_mail doesnt work

f you’re using anything that allows you to configure SMTP within WordPress, take it out. Then put everything into a function: add_action(‘init’,’delay_until_init’); function delay_until_init(){ // call wp_mail() here }

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

You don’t need to pass the from name and email to PHPMailer in your code as it will take it from $headers so try the following: add_action( “phpmailer_init”, “send_smtp_email” ); function send_smtp_email( $phpmailer ) { // ini_set(“sendmail_from”,”[email protected]”); // ini_set(“sendmail_path”,”[email protected]”); // Define that we are sending with SMTP $phpmailer->isSMTP(); // The hostname of the mail server … Read more

wp_mail doen’t send mails whit attachment

Try code below. <?php $attachments = array(); array_push($attachments, WP_CONTENT_DIR . ‘/uploads/my-first-attachment.docx’ ); array_push($attachments, WP_CONTENT_DIR . ‘/uploads/my-second-attachment.zip’ ); $to=”[email protected]”; $subject=”Online: multiple attachment demo through wp_mail of wordpress”; $message=”This is testing”; $headers=”From: NAPSWI online <[email protected]>”; get_header(); if( wp_mail( $to, $subject, $message, $headers, $attachments) ) { // the message was sent… echo ‘The test message was sent. Check … Read more

Sending email with wp_email and AJAX

Have you tried without the ajax? Is that where you’re actually sending the mail? Try just putting the wp_mail function right under headers and see if you get the mail. Also i agree with theDeadmedic. It could be spam. Check the google spam folder and if its’ not there, try sending to an email on … Read more

Is wp_mail plugin territory?

While wp_mail() is not exactly forbidden in a theme, it is very likely misplaced there. The purpose of a theme is presentation. It should not change existing data, and it should always be easy to replace. That’s the reason why contact forms, polls, shops, tracking and similar functionality is pure plugin territory. There is no … Read more