0

With:

add_filter( 'wp_mail_from', 'my_mail_from' );
function my_mail_from( $email ) {
  return "[email protected]";
}
add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
function my_mail_from_name( $name ) {
  return "example.com - Admin";
}

I adjusted the 'user' of the host in the 'function.php' for sending system emails. When testing the contact page, this also works wonderfully and the system fires the message to the admin(not on the same host).

When I test the 'Reset password' (forgotten password?) function, the system does not fire an email (not even to the admin). If a user wants to register, the system also does not fire a registration email. The root directory is recursively owned by www-data:www-data (there were problems installing plugins until I changed them to this user).

Why does it work properly with the contact form but not with new registrations and PW resets? What do I have to do to fix the error or what could be the problem?

…Thank you in advance

6
  • You mentioned a contact form but WordPress doesn't have a contact form feature, is the contact form something you built or something from a plugin or theme? Do password reset emails send if you remove the filters code that you mentioned?
    – Tom J Nowell
    Commented Oct 24, 2023 at 9:37
  • Contact form 7 is installed but I created the contact form before contact form 7 was installed - This one works. The pw-reset function and registry doesn´t work if the filter is removed too. The system fires from [email protected] while sending somthing over the contact-form.
    – kornholio
    Commented Oct 24, 2023 at 10:20
  • Contact-form created by simple page-creation.
    – kornholio
    Commented Oct 24, 2023 at 10:27
  • is simple page creation a plugin? Have you attempted to enter SMTP details at all? It's likely even if your install sends an email that it would be binned as spam/junk, especially if the domain you used in wp_mail_from is not where the server is, it'll see the mismatch and see it as super suspicious. A lot of shared hosts also get put on lists due to hacked sites sending out spam
    – Tom J Nowell
    Commented Oct 24, 2023 at 12:15
  • No 'simple page creation' was not created by a plugin. It was created with the default contact form which is provided from wordpress itself by page creation. The password reset function and user registration is given by default without any adding from pages. The difference between the contact form and these by default given functions is that the contact-form was added after installing - Not while installing.
    – kornholio
    Commented Oct 25, 2023 at 12:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.