Tell us what you are trying to do?
Hi,
I am using user form to register user in my website. In one of the post forms in the website, when the user submit the form an email will be send to an email address in the form (I am using wp_mail php function to send the email). For now the from email is wordpress email because the user email is not authenticated.
With the add_filter hook. Also is your user currently logged in when they are sending the email ? This code will only get the user's email if they are logged in.
Can you provide a little more information as to where the email is to come from ?
The user will fill a post form with some fields like subject and email content. Then when the user enter submit the email will be send to the email in the parent post. I have used wp-mail function that I have added in the functions.php file.
No, my issue is not about sending an email to the parent post. I have already manage to develop the code to send the email to parent post. My issue is exactly as I specified in this ticket.
To make it clear:
What I have achieved:
"To email" -Sending email to post parent when submitting the form. (This is working fine)
What I want to achieve:
"From email"- For now when the email is sent the from email is wordpress. I want to make the from email to be the logged in user email. I think the solution you proposed ( using cred_mail_header)is the correct solution. But I do not know how to added it correctly. Could you please guide me to add the function correctly?
I have added the function in custom code. Also, I have install smtp plugin for email authentication. However, when I test sending email the email from is showing "the wordpress admin" not the "current logged in user".
I have added the two lines of code in the wp_mail function but still not working.
When WP Mail SMTP plugin is activated it still shows the wordpress admin email as from email. However, when the WP Mail SMTP plugin is not activated it shows the wordpres email as the from email. Please advise.