Skip Navigation

[Resolved] User to authenticate their email address to send the email from.

This support ticket is created 4 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 21 replies, has 2 voices.

Last updated by nabils 4 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1708163

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

#1708165

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

#1708579

Many thanks, the from email now shows the login user email. But still the from name shows wordpress.

#1708847

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

#1708955
pic1.png

Please find a screenshot attached.

#1708973

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

#1709081

My issue is resolved now. Thank you!