We cans end mail rom wordpress using both php mail function (mail();) and wordpress mail function wp_mail(wp_mail();).
Php mail function:
TO: sample@sample.com
mail(“sample@sample.com”,”Subject”,”Message”);
From wordpress using this function you will get mail with from field as server details.
WordPress mail function:
TO: sample@sample.com
wp_mail(“sample@sample.com”,”Subject”,”Message”);
From wordpress using this function you will get mail with from field as WordPress, you can customize all these fields.
wp mail using PHP mailer:.
For more details: Reference: https://developer.wordpress.org/reference/functions/wp_mail/