Remove or excerpt text of message notification in Buddypress - wordpress

I have a similar issue as this one: How to edit the registration email sent by buddypress for activating users
In Buddypress if a user sends a "private message" to an other user, the user will the notified via email with the entire text of the message.
How can I either remove or shorten/ excerpt the body of the message ?
This is the text that I mean:
Alexander sent you a new message:
Subject: hallo
"hallo
43545345" <- This is the body which I want to remove/replace or excerpt
To view and read your messages please log in and visit: http://www.mycolombianwife.com/members/alexandra/messages/
To disable these notifications, please log in and go to: http://www.mycolombianwife.com/members/alexandra/settings/notifications/

Use the provided filter hook.
Try this function in bp-custom.php
function user3461751_email_content( $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud ) {
$email_content = 'replacement text';
return $email_content;
}
add_filter('messages_notification_new_message_message', 'user3461751_email_content', 10, 7 );

Related

How to send mail On changing shipping Address by User for woocommerce

I have woocommerce site and in that when User updates their shipping address then one verifying mail should be send to them.
I need hook that checks if any fields are updating or not and when we click "SAVE ADDRESS" and if there is updating any fields.. Mail should be send to them and admin too.
Hi and welcome to StackOverflow! your question very broad, consider asking a more specific question next time my friend.
I'm going to help you with this issue. SO you only need a hook that will run when the user edits their address.
/*The WordPress Core woocommerce after save address validation hook.*/
add_action( woocommerce_after_save_address_validation",'woo_address_updated',10, 3);
function woo_address_updated($user_id, $load_address, $address)
{
/* Get the user email*/
$user_info = get_userdata($user_id);
$subj = 'The email subject';
$body = 'This is the body of the email';
/* Send email*/
wp_mail( $user_info->user_email, $subj, $body );
}

How to assign a SendGrid category with Contact Form 7 and WP Mail SMTP

I'm trying to assign a SendGrid category on the emails sent by a form.
SendGrid documentation mentions the use of X-SMTPAPI, it says it should contain a json object in there, and adding {'category': 'cat1'} is supposed to do the trick.
This is what I've tried.
As WP Mail SMTP uses the v3 API to send mail, you need to add your custom categories to the request body.
You can do this with the following piece of code:
function wp_mail_smtp_add_cat( $body, $mailer ) {
$body['categories'] = array('testcat');
return $body;
}
add_filter( 'wp_mail_smtp_providers_mailer_get_body', 'wp_mail_smtp_add_cat', 10, 2 );
For other parameters, check the v3 documentation: https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html

Wordpress mail gets to spam folder

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 );

Change Password URL missing In forgot Password mail In Wordpress

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;
}

contact form 7 wordpress plugin not working properly

I am using contact form 7 wordpress plugin for one of website and facing problem to adding action after sending mail.
I want to call some CRM Api when data submitted by the user and also sent mail to admin so i have tried following way.
I added action and function to function.php
1)
add_action('init', create_function('',
'add_action("wpcf7_admin_after_mail", "leads_integration_wp_cf7");'));
function leads_integration_wp_cf7($cf7 ) {
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();
if($submission)
{
$posted_data = $submission->get_posted_data();
//using curl make request here
}
}
So using this way i got mail but i am thinking my function(leads_integration_wp_cf7) did not called and i did not get entry in CRM.
2)
add_action('wpcf7_before_send_mail', 'leads_integration_wp_cf7');
using this way i made successfully request to CRM but mail sending stop.on a form page ajax preloader loading,loading, and not redirect on url.
Anybody face this issue i am new in wordpress.
The action wpcf7_admin_after_mail is called in edit-contact-form.php file and it is used for form control ui purpose so it will not be helpful for this case.
The action wpcf7_before_send_mail is correct for doing some task when contact form is posted and email is sent, can you confirm that mail is working properly if this action hook is not applied?
Also try renaming the param $cf7 to $contact_form
function leads_integration_wp_cf7($cf7) {
To
function leads_integration_wp_cf7($contact_form) {
{code: 'invalid_json', message: 'The response is not a valid JSON response.'}
code: "invalid_json"
message: "The response is not a valid JSON response."

Resources