Email ‘from address’ has a www in it
You can change the email address with the wp_mail_from filter: add_filter( ‘wp_mail_from’, function() { return ‘[email protected]’; } );
You can change the email address with the wp_mail_from filter: add_filter( ‘wp_mail_from’, function() { return ‘[email protected]’; } );
The standalone script will not load WordPress, so it doesn’t have a wp_mail() function. WordPress has its own built-in Ajax handlers which you can leverage and have access to all WordPress functionality within those Ajax calls.
Is there a way into making WordPress think that the Google mail servers are local mail servers so that phpmail can be used properly? Yes, you could use a firewall to create a localhost:465 socket that forwards network traffic to smtp.gmail.com:465 but what on earth for?? Is there an alternative solutions? Yes, and you’re half … Read more
Since wp_mail is pluggable, we can selectively override it. I run the following code in my general functionality plugin: /** * Email Async. * * We override the wp_mail function for all non-cron requests with a function that simply * captures the arguments and schedules a cron event to send the email. */ if ( … Read more
Reference link click here. Using below code you can send the mail with html format. $to = ‘[email protected]’; $subject=”The subject”; $body = ‘The email body content’; $headers = array(‘Content-Type: text/html; charset=UTF-8’); wp_mail( $to, $subject, $body, $headers ); // For attachment $attachments = array( WP_CONTENT_DIR . ‘/uploads/file_to_attach.zip’ ); $headers=”From: My Name <[email protected]>” . “\r\n”; wp_mail( ‘[email protected]’, … Read more
Attachments should always use the absolute filesystem path. Also to change the Content-Type of the email you should use the wp_mail_content_type filter. <?php function my_custom_email() { $to = ‘[email protected]’; $subject=”WordPress wp_mail”; $message=” <html> <body> <table rules=”all” style=”border-color: #666;” cellpadding=”10″> <tr>Hello WordPress</tr> </table> </body> </html> “; $attachments = array( WP_PLUGIN_DIR . ‘/my-plugin/uploads/sample_photo_01.jpg’ ); $headers[] = ‘From: … Read more
Filter ‘phpmailer_init’, not ‘wp_mail’. To prevent sending the mail out reset the PHPMailer object. Prototype (not tested): add_action( ‘phpmailer_init’, ‘wpse_53612_conditional_mail_stop’ ); function wpse_53612_conditional_mail_stop( $phpmailer ) { ! my_condition() and $phpmailer = new stdClass; }
What am i doing wrong here? Many, many things, not all performance related. Lets begin with the critical parts, then conclude on your performance issues and what can be done to mitigate and help AJAX API Firstly, you’re not using the AJAX API, and reinventing the wheel. It’s quite simple: JS: $.post( do_mail_sending.ajaxurl, { action: … Read more
Here is a better WordPress SMTP mailer. https://wordpress.org/plugins/postman-smtp/
Assuming that $member_details->user_login is already a user in the wp_users table, then you could use the following to get their email address: $user = get_user_by( $member_details->user_login, ‘login’ ); From there, you have the user’s email address and can use wp_mail() to email them: $subject = “My email subject”; $message = “My message body…”; wp_mail( $user->user_email, … Read more