I have a big problem with my site Wordpress, i have changed the password of the default mail wordpress ( the mail used in the first installation wordpress ).
Now is impossible send mail to new users than sign in on my site.
How can I change the password in wordpress, for the default mail ?
Where is the configuration file for send email ( SMTP user and password ) ?
Greetings.
I have found a solution
Here is a code snippet example with comments for each setting to configure WordPress to sent SMTP email:
add_action( 'phpmailer_init', 'send_smtp_email' );
function send_smtp_email( $phpmailer ) {
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// The hostname of the mail server
$phpmailer->Host = "smtp.example.com";
// Use SMTP authentication (true|false)
$phpmailer->SMTPAuth = true;
// SMTP port number - likely to be 25, 465 or 587
$phpmailer->Port = "587";
// Username to use for SMTP authentication
$phpmailer->Username = "yourusername";
// Password to use for SMTP authentication
$phpmailer->Password = "yourpassword";
// Encryption system to use - ssl or tls
$phpmailer->SMTPSecure = "tls";
$phpmailer->From = "you#yourdomail.com";
$phpmailer->FromName = "Your Name";
}
To use this snippet, you will need to adjust the settings according to your email service requirements. Check with your host.
The snippet, once configured, can be added to your theme’s functions.php file.
Related
When I try to login into my wordpress admin account website, I can't. This happens just after I Move Wordpress from Local Server to Live Website.
When I try to get access to my website, i fail and I receive this mail in return:
"Access was denied because the password being used exists on lists of passwords leaked in data breaches. Attackers use such lists to break into sites and install malicious code. Please change or reset the password"
But the problem is worst because when I try to change my password, I get this message:
Password recovery attempted
"Someone tried to recover the password for user with email address: blablaemailadress.FR"
Then I realise I made a mistake when I suscribe to wordpress local because ** I put the wrong email adress instead of the good one** which is blablaemailadress.COM
After that I change my WordPress email and password in the database phpmyadmin but even after the issue continue! I can't log into my admin website and I still continue to get the same mail which say to change my password and to "confirm" the new password with still the wrong e-mail adress...
IF someone can answear or have a similar problem, I will be glad to hear you
To change the WordPress admin email address in PhpMyAdmin, you need to update it in both tables _options and _users (where _ is prefixed with your own prefix)
In _options the row for option_name = admin_email set the
option_value = yournewemail#example.com
In _users the row for your account just replace the user_email
Create new User by below code, then check old User detail in admin panel.
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = 'webmaster#mydomain.com';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
} );
I'm using contact form 7 and facing a problem with this email id, I'm not getting any mail what we can do for that. I used SMTP also.
could you please suggest me any other option.
have you checked spam folder ? Perhaps emails are in spam for email not get in spam you can use https://wordpress.org/plugins/wp-mail-smtp/
Here is setup documentation https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/.
Please check may be helpful for you.
The best option is using PhpMailer library in php. You can check if the email was sent successfully using php mailer. All you need to do is to take all the library code and add it to your FTP or install it using composer.
Here is a simple example.
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
// Load Composer's autoloader
require 'vendor/autoload.php';
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'user#example.com'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
//Recipients
$mail->setFrom('from#example.com', 'Mailer');
$mail->addAddress('joe#example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen#example.com'); // Name is optional
$mail->addReplyTo('info#example.com', 'Information');
$mail->addCC('cc#example.com');
$mail->addBCC('bcc#example.com');
// Attachments
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
You can get all the information on PhpMailer here Php Mailer On Github
The PhpMailer is well configured so you don't have to worry about your emails ending up in Spam folder. Also be careful on the number of mails you send periodically to single recipients.
My Wordpress site registration email gets into the spam folder.
My client uses an old version of Microsoft exchange without SMTP support.
so I can't send the mails true SMPT. And my servers Pp is not Blacklisted.
Domain:
cottex.se
SPF on the Domain:
v=spf1 mx a ip4:178.62.70.32 ?all
I have not setup DKIM(DomainKeys Identified Mail) Because I can't find how to sign the WordPress outgoing mail with a private key.
I really can't understand whats wrong! the SPF should be enough or?
I would like to recommend test your mail on this website
It show you details about problems on the your mail domain.
Send message to specified email and click blue button.
Please use this code its help you:-
Note: You need to use valid email and name here.
add_filter( 'wp_mail_from', 'my_mail_from' );
function my_mail_from( $email ) {
return "enter yout 'from' id";
}
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from_name($old) {
return 'enter your "from name"';
}
wp_mail( $admin_mail, $subject, $message );
I recently installed buddypress in my wordpress.
When a person registers on my website using registration form
a message appears saying that an activation link has been sent to the email address you provided, but user receives no email.
Please tell me to solve this.
is there any problem in wp_mail or do I need to config
something in my hosting file manager?
First , test the wp_mail function with the following code by creating wp-test.php in root folder.
include 'wp-load.php';
$to = 'example#example.com';
$subject = 'The subject';
$body = 'The email body content';
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail($to, $subject, $body, $headers);
After that if it's still not working , you need to install and configure Easy WP SMTP and setup the SMTP settings from your host.
I'm requesting Wordpress for Forgot password. I also got the mail from wordpress site.
But the change password url is missing from it.
The mail is as below :
Someone requested that the password be reset for the following account: https://www.example.com/ Username: abc#example.com If this was a mistake, just ignore this email and nothing will happen. To reset your password, visit the following address:
The link is not receiving in the mail.
What should be reason for it ?
you can do this using retrieve_password_message filter
add_filter( 'retrieve_password_message', 'modify_forgot_mail_contnet', 10, 2 );
function modify_forgot_mail_contnet($message, $key){
// here $message it the mail content , which you can modify as per your requirment and $key is activation key
// after modifying you must return $message
return $message;
}