Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Nabils,
I did some checks on the wordpress docs to see how to modify the header for the FROM section and it should go like this.
$current_user = wp_get_current_user();
$from = $current_user->user_email;
$headers[] = 'From: '.$from;
wp_mail( $to, $subject, $message, $headers );
So adopt your code to my example above.
Here is the reference document that i've been using to assist you.
https://developer.wordpress.org/reference/functions/wp_mail/
Thanks,
Shane
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Nabils,
I did some checks on the wordpress docs to see how to modify the header for the FROM section and it should go like this.
$current_user = wp_get_current_user();
$from = $current_user->user_email;
$headers[] = 'From: '.$from;
wp_mail( $to, $subject, $message, $headers );
So adopt your code to my example above.
Here is the reference document that i've been using to assist you.
https://developer.wordpress.org/reference/functions/wp_mail/
Thanks,
Shane
Many thanks, the from email now shows the login user email. But still the from name shows wordpress.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Nabils,
Can you send me a screenshot of this email so that I can see exactly what you are referring to ?
Thanks,
Shane
Please find a screenshot attached.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Nabils,
I see the issue.
Can you change this line below from:
$headers[] = 'From: '.$from;
To:
$headers[] = 'From: Some Info <'. $from.'>';
This should be the expected format of the mail function.
Thanks,
Shane
My issue is resolved now. Thank you!