0

I have a website that sends out text messages from the server. I'm using PHP for it:

$headers = "From: " . "Business Name <[email protected]>" . "\r\n";
$result = @mail( $to,$subject,$message,$headers);

Up until yesterday, the FRM: was always "Business Name" in the text message.

Suddenly, I'm now getting reports that FRM: is coming in as [email protected] where username is my actual FTP account username (real IP not provided of course)!!

I definitely don't want to expose my FTP username. Is there something that would determine the FRM: name other than what I have set? I haven't changed the script at all... and suddenly it has changed.

UPDATE: using PHP mail not SMS Gateway

5
  • I have it set with a cron script. I didn't set it to a phone number.. I can't remember why but I'm not sure a number worked for the reply. I used an email address because the replys came through that fine that way.
    – cpcdev
    Aug 17, 2014 at 1:04
  • I don’t think the OP is sending SMS/text messages – after all, they are just using mail
    – CBroe
    Aug 17, 2014 at 1:07
  • PHP mail... free 99!
    – cpcdev
    Aug 17, 2014 at 1:12
  • Did this stackoverflow.com/a/25345434/1342440 not solve your issue? Aug 17, 2014 at 1:15
  • @Brian link takes me to this same thread
    – cpcdev
    Aug 17, 2014 at 1:18

2 Answers 2

2

You can add a command line parameters to php's mail function, one of which is from.

mail($to, $subject, $message, $headers, '[email protected]');

Note the -f directly infront of your from address

2
  • Brian, will the solution you gave still show "Business Name" as opposed to the actual email address?
    – cpcdev
    Aug 17, 2014 at 1:16
  • Set your headers as is, just add the additional parameter Aug 17, 2014 at 1:30
0

This may be related to the mail server on the local machine or the mail configuration on the local machine. There are certain settings, which can prevent faking the FROM header and substituting it by the actual user running the program that sends the mail.

I recommend checking the mail config for php and for the system itself.

1
  • php mail is used and [email protected] is an email address which overwrites the given email address. That's related to mail config all before anything is passed to any SMS gateway. Aug 17, 2014 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.