Mobile app version of vmapp.org
Login or Join
Si4351233

: CPanel Mail Function There is a wordpress installation installed on a cpanel account. They have a contact form on that wordpress installation that is sending using the php mail function. It is

@Si4351233

Posted in: #Cpanel #Dns #Email #Php

There is a wordpress installation installed on a cpanel account. They have a contact form on that wordpress installation that is sending using the php mail function. It is supposed to be sending like this:

noreply@cpanel_example.com -> info@cpanel_example.com


But it is sending like this, using the servers hostname with the cpanel username and the email account name.

cpanel_example@server.whm_example.com -> info@cpanel_example.com


What is causing this?

*Edit

So I added a plugin in WordPress which allowed the php mail function to send from wordpress@cpanel_example.com. I don't know how it did this though. So I feel the issue is with the default php mail function sender address.

*Edit 2 (example php code)

<?php
$to = 'info@cpanel_example.com';
$subject = 'The test for php mail function';
$message = 'Hello';
$headers = 'From: noreply@cpanel_example.com' . "rn" .
'Reply-To: noreply@bcttransfers.com' . "rn" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);


*Edit 3 (wordpress plugin used that allowed the emails to be sent from wordpress@cpanel_example.com)
wordpress.org/plugins/wp-mail-smtp/
SETTINGS
From Email: BLANK (default address used: wordpress@bcttransfers.com)
Mailer: Default (none)
Return path: checked

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Si4351233

1 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

Rather than use the default php mail function directly sending via the webserver, you may want to configure the Wordpress site to send via SMTP. I like to use the Easy WP SMTP plugin

With the plugin enabled, your site can send emails "officially" through an SMTP enabled mail account, even it is one created in CPanel on your hosting provider. The advantage to sending via SMTP and not directly through phpmail or sendmail is mitigating the likelihood of your messages being flagged as spam (sometimes because the shared server IPs being blacklisted, other times because of overridden email headers).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme