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!
Wed 26/05/10 at 21:35
Regular
"Ctrl, Alt, Woof"
Posts: 212
LukeM wrote:
>
>... My advise would be to just simply set it as the
> address for from parameter, and use additional headers to mask the proper name onto the from field.

that's what I've done - it's working a treat.

thanks again.

JTD
Wed 26/05/10 at 14:42
Regular
"Embrace the Martian"
Posts: 285
JimTheDog wrote:
> ... a bit more on this if you're interested..
>
> If you use the 'proper name
> '
with the -f switch then you
> get a duplicate of the mail sent back to the address stated in
> the -f switch - but it has the intended recipient's address in
> the 'to' field. The intended receipient does get the mail OK.
>
> I found this out after sending three mails to my whole members
> list and getting a copy of every mail sent back to my account.
>
> With the 'proper name' removed then no duplicate is sent.
>
>
> JTD

Strange eh? I also noticed abnormalities when playing around with the flag. My advise would be to just simply set it as the address for from parameter, and use additional headers to mask the proper name onto the from field.
Tue 25/05/10 at 21:25
Regular
"Ctrl, Alt, Woof"
Posts: 212
LukeM wrote:
> Glad it worked out for your JTD, but as for the Reply-To, not too
> sure as to why that would be. Thanks for letting us know how you
> got on!


... a bit more on this if you're interested..

If you use the 'proper name ' with the -f switch then you get a duplicate of the mail sent back to the address stated in the -f switch - but it has the intended recipient's address in the 'to' field. The intended receipient does get the mail OK.

I found this out after sending three mails to my whole members list and getting a copy of every mail sent back to my account.

With the 'proper name' removed then no duplicate is sent.


JTD
Mon 24/05/10 at 11:25
Regular
"Embrace the Martian"
Posts: 285
Glad it worked out for your JTD, but as for the Reply-To, not too sure as to why that would be. Thanks for letting us know how you got on!
Sat 22/05/10 at 10:10
Regular
"Ctrl, Alt, Woof"
Posts: 212
LukeM wrote:
> JimTheDog wrote:
> Many Thanks for your efforts LukeM.
>
> I'll be trying that over the weekend - I'll post back how I get
> on.
>
...> JTD
>
> No problems! Be sure to share your findings :D
>
> Luke


Hi Luke<

I've implemented your method as per your gist examples and it works like a dream. Simple solution really - but well investigated.

My code:


//mail() wrapped in another function so I can call myMail() from anywhere and it always sends the same mailer datails

function myMail($to, $subject, $body){
$from = 'my proper name <[email protected]>' $eheader = 'FROM: '.$from;
//."rn".' Reply-To: '.$from; Reply -to removed to avoid spam flagging
$eparam = '-f '.$from;
$mailer = mail($to, $subject, $body, $eheader, $eparam);
};


Interstingly if I use the Reply-To element then my mails get flagged as possible spam on at least two of the mail systems I'm sending to.

Many thanks

JTD
Fri 21/05/10 at 17:11
Staff Moderator
"Aargh! Broken..."
Posts: 1,408
The JS plugin is on my list. But then I'm slowly moving stuff off my list onto LukeM's. It's still too long though!
Fri 21/05/10 at 16:07
Regular
"Embrace the Martian"
Posts: 285
Who knows what's next on my list?!
Fri 21/05/10 at 15:22
Moderator
"Are you sure?"
Posts: 5,000
LukeM wrote:
> It's now on the bottom of my list. So the good news is forum
> posting just got moved up the list!

Ha! :¬)



By a process of elimination I've worked out you must now be working on the InstantPro Adsense/JavaScript plugin!


PS. I know people want this as I've received emails from complete strangers on it.
No one has ever asked me about RSS :¬P



[s]Hmmm...[/s] My Freeola InstantPro Site
Fri 21/05/10 at 15:16
Regular
"Embrace the Martian"
Posts: 285
Hmmm... wrote:
> LukeM wrote:
> Perhaps someone could look at Freeola's generic
> form_to_mail.php
> script at some point in the future?

It's now on the bottom of my list. So the good news is forum posting just got moved up the list!
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:

Unrivalled services
Freeola has to be one of, if not the best, ISP around as the services they offer seem unrivalled.
I am delighted.
Brilliant! As usual the careful and intuitive production that Freeola puts into everything it sets out to do. I am delighted.

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.