GetDotted Domains

Viewing Thread:
"New mail() PHP Advice"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 20/05/10 at 16:19
Regular
"Embrace the Martian"
Posts: 285
After some testing on our free servers I have found out some interesting things. Please note these tests only reflect the current server configurations which may change from time to time (for security reasons etc.).

Check out my mail() .php test gist on github.com.

After running this I have found that not sending with -f flag can be done. It might still be safer always to set it however.

To add nice names as requested by JimTheDog in Hmmm's thread all you need to do is utilise the fourth parameter in the mail() function for additional headers. Just format e-mail addresses in the following way:

Nice Name <[email protected]>

Just a handy tip!
Thu 20/05/10 at 16:19
Regular
"Embrace the Martian"
Posts: 285
After some testing on our free servers I have found out some interesting things. Please note these tests only reflect the current server configurations which may change from time to time (for security reasons etc.).

Check out my mail() .php test gist on github.com.

After running this I have found that not sending with -f flag can be done. It might still be safer always to set it however.

To add nice names as requested by JimTheDog in Hmmm's thread all you need to do is utilise the fourth parameter in the mail() function for additional headers. Just format e-mail addresses in the following way:

Nice Name <[email protected]>

Just a handy tip!
Thu 20/05/10 at 17:12
Moderator
"Are you sure?"
Posts: 5,000
Hi Luke,
Have you tested this with a non-Freeola registered email address?

Am I right in thinking this is supposed to put the visitors email address in the 'From' field when a form is submitted? This would mean that you could then hit Reply and not have to change the email address before clicking Send.

I remember when the changes were made as documented here to your formmail script for security/spam reasons. If you are sure this will work with non-Freeola addresses perhaps this could be updated?


[s]Hmmm...[/s]
Thu 20/05/10 at 17:43
Regular
"Embrace the Martian"
Posts: 285
Hmmm... wrote:
> Hi Luke,
> Have you tested this with a non-Freeola registered email
> address?
>
> Am I right in thinking this is supposed to put the visitors
> email address in the 'From' field when a form is submitted? This
> would mean that you could then hit Reply and not have to change
> the email address before clicking Send.
>
> I remember when the changes were made as
> documented
> here
to your formmail script for security/spam reasons. If
> you are sure this will work with non-Freeola addresses perhaps
> this could be updated?

I have not tested with non-freeola addresses, you can try my gist on your own Freeola account with a non-freeola e-mail address though.

I'll have a look later this evening myself.

Please note: I am talking about using mail() function rather than the form to mail script. The behaviour may be different with that script.
Thu 20/05/10 at 17:54
Moderator
"Are you sure?"
Posts: 5,000
I'll let you test things if that's ok? ;¬) Bit busy here...

As I mentioned 'you' did introduce the changes for security reasons...

It will be interesting to see how you get on.
[s]Hmmm...[/s]
Thu 20/05/10 at 19:44
Regular
"Embrace the Martian"
Posts: 285
And as promised here are my findings on using the PHP mail() function on our free servers. First the function:
mail($from, $subject, $message, $additional_headers, $additional_flags);
Only the first three fields are required in PHP. PHP then parses the constructed e-mail onto sendmail.

Now here are some bullet points of my findings:
- Not setting $additional_headers or $additional_flags will mean a server e-mail address will be used as the from address
- $from must be a Freeola E-mail address
- $additional_headers can overwrite $additional_flags and $from
- $additional_flags can overwrite $from

That means you can use a valid Freeola E-mail address in the $from and then mask it using either $additional_headers or $additional_flags.

It also means currently the server does not require the -f flag if you provide a From header in $additional_headers. If you set the -f flag and provide a From field in $additional_headers, the -f flag will be overwritten and is left unused.

Also it is worth pointing out $additional_headers is better than using -f anyway since you can style the from field as such:

$additional_headers = "From: Luke M <[email protected]>";

rather than just
$additional_flags = "-f [email protected]";

So there you have it, a myth buster on our free servers.
Thu 20/05/10 at 20:30
Regular
"Ctrl, Alt, Woof"
Posts: 212
Many Thanks for your efforts LukeM.

I'll be trying that over the weekend - I'll post back how I get on.

Once again sorry to Hmmm... for confusing his thread.

I am a baaaad dog.

JTD
Thu 20/05/10 at 22:38
Regular
"Embrace the Martian"
Posts: 285
JimTheDog wrote:
> Many Thanks for your efforts LukeM.
>
> I'll be trying that over the weekend - I'll post back how I get
> on.
>
> Once again sorry to Hmmm... for confusing his thread.
>
> I am a baaaad dog.
>
> JTD

No problems! Be sure to share your findings :D

Luke
Fri 21/05/10 at 08:57
Moderator
"Are you sure?"
Posts: 5,000
LukeM wrote:
> That means you can use a valid Freeola E-mail address in the
> $from and then mask it using either $additional_headers or
> $additional_flags.

This all sounds good.
Would you be able to use this info to add a new option to the Freeola formmail script so that the visitors email address can come through as the 'From' address?





[s]Hmmm...[/s]
Fri 21/05/10 at 11:32
Regular
"Embrace the Martian"
Posts: 285
Form to Mail will always require From addresses to be Freeola owned addresses, as for allow more customisation of the From address to include your name perhaps this would work:


<input type="hidden" name="from" value="Luke <[email protected]>">


I have not tested though nor have I looked at how Form to Mail actually works.
Fri 21/05/10 at 12:54
Moderator
"Are you sure?"
Posts: 5,000
LukeM wrote:
> ...nor have I looked at how Form to Mail actually works.


Nice answer :¬P

It would be useful for people if the visitors address could be used in the 'From' field as many people just hit reply from a form submission and end up writing to themselves!

It's been brought up here a few times in the past...

Perhaps someone could look at Freeola's generic form_to_mail.php script at some point in the future?


[s]Hmmm...[/s]

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Best Provider
The best provider I know of, never a problem, recommend highly
Paul
I've been with Freeola for 14 years...
I've been with Freeola for 14 years now, and in that time you have proven time and time again to be a top-ranking internet service provider and unbeatable hosting service. Thank you.
Anthony

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.