SMTP Issues with Office 365

I'm having issues setting up SMTP for Office 365 using the Easy WP SMTP plugin. I keep getting the following vague error message. SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting I've looked through most of the Troubleshooting documentation and have had no luck. Please see the image below for the settings I'm using. It seems like other people have experienced the same issue with Office 365. Any ideas?
Topic: smtp Wordpress
Category: Web

Mailing issues with wordpress?

I'm working on a client's website and they are not getting messages from the site anymore. I've found that no mail will go to an email address ending in @gmail.com, I can send mail just fine to anyone within my company that has an email with a custom domain. But a Gmail inbox the messages never even seem to make get close. They're not in spam, not in promotions, nowhere. I've installed WP mail log, and see no errors on …
Category: Web

SMTP connect() failed

We are trying to get our set up an SMTP function but keep hitting errors with the test email. We even tried both WP-Mail-SMTP and Easy WP SMTP. After talking with our host at WPEngine we couldn't find any issue on their end since they do use OpenSSL and told us to use port 2525 since we are using Outlook. Our IT department also said that port should work just fine and isn't blocked by Outlook. I even used another …
Topic: smtp Wordpress
Category: Web

WordPress doesn't send SMTP email even by phpmailer hook

I used this code in my child theme(child theme functions.php): add_action( 'phpmailer_init', 'wpse8170_phpmailer_init',0 ); function wpse8170_phpmailer_init( PHPMailer $phpmailer ) { $phpmailer->Host = 'your.smtp.server.here'; $phpmailer->Port = 25; // could be different $phpmailer->Username = '[email protected]'; // if required $phpmailer->Password = 'yourpassword'; // if required $phpmailer->SMTPAuth = true; // if required $phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another possible value $phpmailer->IsSMTP(); } But it doesn't send SMTP mail. I checked the SMTP credentials with SMTP programs(like wp mail SMTP) and …
Category: Web

Using SMTP Function instead of Plugin (functions.php)

While this works just fine, I am concerned that it poses a security threat. Does it? add_action( 'phpmailer_init', 'send_email_using_smtp' ); function bsend_email_using_smtp( $phpmailer ) { $phpmailer->isSMTP(); $phpmailer->Host = 'mail.example.com'; $phpmailer->SMTPAuth = true; $phpmailer->Port = 465; $phpmailer->Username = '[email protected]'; $phpmailer->Password = 'your-email-account-password'; $phpmailer->SMTPSecure = 'ssl'; $phpmailer->From = '[email protected]'; $phpmailer->FromName = 'Your company name'; }
Category: Web

Wordpress doesn't work properly with non standard domain names - PHPMailer fails when initialising

While debugging Wordpress password reset functionality in a test environment on a local macbook, Wordpress would get stuck when sending emails. Basically, before sending emails, a check is done in wp-includes/pluggable.php on sender email address, subject, etc, and further debugging showed that Wordpress is failing on line 408 (in version 5.8.2) $phpmailer->setFrom( $from_email, $from_name, false ); Ironically, this built-in check is performed before my custom action would correctly set the parameters: add_action( 'phpmailer_init', 'my_phpmailer_example',5 ); function my_phpmailer_example( $phpmailer ) { …
Category: Web

Using WP_Mail on MacOS 12 (Monterey - M1)

On a brand new Macbook running Monterey (M1), as PHP was removed by Apple on OS 12, I have removed all "AMP" preinstalled by Apple and installed HomeBrew "AMP" (with PHP 7.4), which is running perfectly. Now, as I have setup Wordpress for testing purposes, I am attempting to use Wordpress WP_Mail function, which relies on PHPMailer, which in turn uses PHP Mail command. The latter relies on system specific libraries, and I am bit confused about configuring the correct …
Category: Web

Submitting product attributes via Ninja Forms wordpress?

I have a wordpress website selling products. On the product page there is a button “Ask a question”, through which a pop-up form created on the basis of the “Ninja forms” plugin opens. There are fields for input, when they are filled in, a letter is sent to the mail. But the customer wants the attributes of the product (size, material, etc.), through which the user asks the question, to come as well. Attributes are displayed on the product page …
Category: Web

Is it secure to use SMTP password in .php file in WordPress website?

Currently I am making feedback contact form without a plugin. Trying not to use plugins if possible. In action .php file there must be written server settings such as SMTP server, SMTP username etc. and eventually SMTP password. As it is not a Gmail, but hosting mailbox, SMTP password and mail password are the same. Says, that sending mail using SMTP is more secure. But if I will write all this data into my .php file insite WordPress platform will …
Category: Web

SMTP emails not picking up the correct From name and From email

I am using an SMTP plugin to manage my emails in WordPress. Previously I used a plugin called EasyWP SMTP. since it did not meet my needs I unstalled it and installed Post SMTP Mailer. now everything working fine. Even I can see email logs. But except for one situation. When I try to resend an email from the Email Logs interface. I receive the correct email. But From Name replace by : EasyWP (instead of my site name) From …
Category: Web

How can I configure an SMTP Server?

I'm trying to follow the instructions here: https://gist.github.com/butlerblog/7e4dbafcbc61b15505ee8ca90510f1e7 But I'm getting confused. I'm not sure what arguments to pass where. Here is what I have: define( 'SMTP_USER', '[email protected]' ); // The email address I use when I log in to the wp-admin page define( 'SMTP_PASS', '123password' ); // The password I use when I log in to the wp-admin page define( 'SMTP_HOST', 'localhost' ); // I am testing this on localhost define( 'SMTP_FROM', '[email protected]' ); // Also the email address …
Category: Web

Getting 400 Error: redirect_uri_mismatch when trying to grant permission to Gmail SMTP plugin

I am trying to add Google SMTP plugin to my wordpress website. I have installed plugin, then went to Google Developer Console created new project, added Gmail API, added Credentials. Now this step came out different to how I remember it used to be. Instead of getting API key I got a JSON file that has all the info, still fields seem to match mostly. I then went to settings form in Gmail SMTP Plugin and mapped settings in following …
Category: Web

Running SMTP Conditionally

I'm working on developing a support website and I'm using Gravity Forms to handle the support ticket form. I have the form notification configured so that the "From" shows my client's email address instead of the email address from the SMTP. I found some code to execute from my functions.php file that will change the default wp_mail() if the "From" email doesn't match. Exactly what I want..: add_filter('wp_mail_from', 'doEmailFilter'); add_filter('wp_mail_from_name', 'doEmailNameFilter'); function doEmailFilter($email_address){ if($email_address === "[email protected]") return '[email protected]'; else return …
Category: Web

Send email using wordpress plugin on behalf of someone with their permission

I have seen a few sites that send an email on behalf of a user, however when the email comes through it appears only as if its come from the user. For example contact forms on websites. I am looking to do the same thing but obviously with the users permission. Is this possible to do in Wordpress or similar services available that won't go to the spam/junk folder? Ideally the from/replyto email address should appear from the user and …
Category: Web

SMTP Error: Could not authenticate

In wordpress I am getting error SMTP Error: Could not authenticate. Here is the log file: Versions: WordPress: 5.6 WordPress MS: No PHP: 7.4.3 WP Mail SMTP: 2.5.1 Params: Mailer: smtp Constants: Yes ErrorInfo: SMTP Error: Could not authenticate. Host: mail.vitalticks.com Port: 587 SMTPSecure: tls SMTPAutoTLS: bool(true) SMTPAuth: bool(true) Server: OpenSSL: OpenSSL 1.1.1f 31 Mar 2020 Apache.mod_security: No Debug: Mailer: Other SMTP SMTP Error: Could not authenticate. SMTP Debug: 2021-01-05 05:42:43 Connection: opening to mail.vitalticks.com:587, timeout=300, options=array() 2021-01-05 05:42:43 Connection: …
Category: Web

Storing Email Account Passwords for SMTP Mailing for a WordPress Plugin

I am currently converting a client booking system I created into a WordPress plugin. It uses the PHPMailer library to send emails. I am using SMTP security to send the emails and thus need the email account and password. I am currently encrypting the passwords in a database and decrypting them when I need them. Everything works fine and I have no problem doing that. If I were to make this into a plugin that would end up in the …
Category: Web

Create mail form using PHPmailer

I'm learning about coding plugin. I trying to create a form in plugin page and it can send mail. This is my code, but it doesn't work(I did not receive email and did not show any error). add_action('admin_menu', 'add_contact_us_page'); function add_contact_us_page() { add_menu_page( __( 'Contact Us', 'textdomain' ), __( 'Contact Us','textdomain' ), 'manage_options', 'support_form_page', 'support_form', '' ); } function support_form() { ?> <form action="" method="post" enctype="text/plain"> Name:<br> <input type="text" name="name"><br> E-mail:<br> <input type="text" name="email"><br> Message:<br> <input type="text" name="message" size="50"><br><br> <input …
Category: Web

Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce

I wish to set up 2 smtp accounts on my wordpress site: 1 for woocommerce orders 1 for all other forms i have the following code, but i am having trouble filtering the woocommmerce order. I am missing somthing. Here is the code: add_action( 'phpmailer_init', 'send_smtp' ); function send_smtp( $phpmailer ) { if ( true === 'WC_Email' ) { $phpmailer->Host = SMTP_WC_HOST; $phpmailer->SMTPAuth = SMTP_WC_AUTH; $phpmailer->Port = SMTP_WC_PORT; $phpmailer->Username = SMTP_WC_USER; $phpmailer->Password = SMTP_WC_PASS; $phpmailer->SMTPSecure = SMTP_WC_SECURE; $phpmailer->From = SMTP_WC_FROM; …
Category: Web

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', '[email protected]' ); // Username to use for SMTP authentication define( 'SMTP_PASS', 'password' ); // Password to use for SMTP authentication define( 'SMTP_HOST', 'smtp.gmail.com' ); // The hostname of the mail server define( 'SMTP_FROM', '[email protected]' ); // SMTP From email address define( 'SMTP_NAME', 'My Site Name' ); // SMTP From name define( 'SMTP_PORT', '465' ); …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.