Skip Navigation

[Résolu] User to authenticate their email address to send the email from.

This support ticket is created Il y a 3 années et 9 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Marqué : 

This topic contains 21 réponses, has 2 voix.

Last updated by nabils Il y a 3 années et 9 mois.

Assisted by: Shane.

Auteur
Publications
#1708163

Shane
Supporter

Languages: Anglais (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: Anglais (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: Anglais (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: Anglais (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!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.