Jump to content

PHP Mail


Nexus10

Recommended Posts

Messages sent using the php mail function on my webhost's server appear on the email's sent to the user that it was mailed by/from 'sererXXX.mywebhost.com'. Is there a way to hide this/change this so that the user does not know who my hosting providor is (a possible security exception in my opinion I think).

 

:shrug:

Link to comment
Share on other sites

$to = $email;
$subject = "Account Verification";
$header = "from: NexusIndustry <admin@nexusindustry.com>";
$message = "Your confirmation link: \r\n";
$message .= "Click on this link (or copy and paste into the address bar) to activate your account \r\n";
$message .= "http://www.nexusindustry.com/admin/confirm.php?passkey=$email_auth";

$sentmail = mail($to, $subject, $message, $header);

Link to comment
Share on other sites

Just use PHP Mailer, and authenticate with your mail server before sending messages. This would eliminate the erronious e-mail account from showing up.

 

Yes, it's more complicated to use PHP Mailer, but it's more accurate, and ensures that every message sent from you is coming from you.

 

I can not believe how many programs are created with this design flaw, and I really wish PHP would either toss the command or update it to allow for:

 

Authentication

POP before SMTP

SSL / TLS

In script configuration

CC/BCC/etc

HTML/Plain combination body text

MIME

IMAP Support

 

Rather than monkeying about with headers, and still don't have several of the above features, such as POP before SMTP, or SSL/TLS.

 

Just wish that developers would stop being so lazy with this area if they wish to distribute/sell the application. (not saying thats what you are doing here, but since I have signed up, you are around the 12th person who is using mail() ..... i know it's easier, but it really does create a lot of headaches --  aka...  your host e-mail account showing up as originator e-mail in the header, automatically ending up in anyones spam box who uses a server that checks if your account was authenticated with your server frst -- direct mail is 99% of the time spam).

 

Hope this helps you anyway.

Link to comment
Share on other sites

Using the standard PHP mail function is fine if you're sending plain TEXT email and you don't need much customization. I agree that you should use the PHPMailer class if you want to send HTML mail or need to customize the headers.

 

If you don't want to use the PHPMailer class, try using the 5th parameter to the mail() function where you can specify other headers.

 

Change

<?php
$sentmail = mail($to, $subject, $message, $header);
?>

 

to

<?php
$sentmail = mail($to, $subject, $message, $header,'-f admin@nexusindustry.com');
?>

 

Ken

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.