what are you trying to achieve or change?
core files like pluggable.php should generally be left unedited; and they will get overwritten with any update.
I want to change the sender’s email from wordpress to me, I am not willing to use a plugin, the only way was editing pluggable.php.
‘wordpress@’ . $sitename; >> These are the lines I changed but now I have to worry about every update. Any solution?
You can already set an email address in wordpress admin backend under “Settings” -> “General” -> “Email address”.
When users register in my site, they get an email like: wordpress@yourdomain.com
The code $from_email = 'wordpress@' . $sitename; in pluggable.php shows the sender as wordpress. This line of code displays as wordpress@yourdomain.com.
Got my point?
Add fhe following in functions.php file.
// changing from name
function rv_mail_from_name($name) {
return ‘NAME;
}
// changing email
function rv_mail_from($content_type) {
return ‘EMAIL@DOMAIN.COM’;
}
add_filter(‘wp_mail_from’,’rv_mail_from’);
add_filter(‘wp_mail_from_name’,’rv_mail_from_name’);
Edit: And ofcourse change the NAME and EMAIL@DOMAIN.COM to whatever you like.
@rvwebstudio
Thanks, but the code has something wrong. I am using Aptana text editor and it gave me error in this line: return 'EMAIL@DOMAIN.COM';
I changed the name and email to mine but still the whole website is down because of an error.
I appreciate your help
Interesting thanks!
The error is on the line with the ‘NAME. A ‘ is missing here.
Ok …. i am on mobile so can not debug right now. Please remove the code you added, so website works correctly. I’ll check again and update soon.
There is a single quote missing in
return 'NAME';
Other than that code is working fine for me.
If I am using a multisite that has two sites (one on the domain and one on the subdomain). Do I have to place the code in both child themes or only on the child on the main site?
I highly appreciate if someone can answer my last question.
Thanks