Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
jedrzej310 is on a distinguished road
 
Posts: 1
Join Date: Jun 2012
Default php e-mailing - 06-14-2012, 07:00 PM

When sending an e-mail from php to a destination e-mail address the user receiving the mail has on its client side the foollowing format of the mail sender (on his FROM field) eg.:

a2323@srv10.000webhost.com

Would it be possible to customize this format i.e to change at least one portion either on left or right of the @ sign ??

(For example this would be good enough: JohnLee@webhost.com)

Regards, Jedrzej
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Doug Lochert's Avatar
Senior Member
Doug Lochert is on a distinguished road
 
Posts: 378
Join Date: Jun 2012
Location: Canada
Default 06-15-2012, 02:44 PM

The email address above looks like your assigned default webhost email, and is likely used due to not assigning your own value for the "From" value in your email form.
Although you can assign your desired "FROM" value to "JohnLee@webhost.com" I would not suggest this unless you actually own said email adddress.

Yes, you may define the "From" values in your mail script.
Code:
Example:
//DEFINE SOME VARIABLES
$to = "$_POST[email];
$subject = "Your email subject line";
$message = "$_POST[message]";
$adminemail = "youremail@domain.com"
$website = "www.yourdomain.com";

// SEND THE EMAIL AS PER DEFINED VARIABLES
mail($to, $subject, $message, "From: $website <$adminemail>\n");

Last edited by Doug Lochert; 06-15-2012 at 03:15 PM. Reason: Missing closing tag in Code Sample
Reply With Quote
(#3 (permalink))
Old
bdistler's Avatar
Member
bdistler is on a distinguished road
 
Posts: 59
Join Date: Jan 2011
Location: Arizona, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Default 06-17-2012, 02:39 PM

Quote:
Originally Posted by Doug Lochert View Post
Yes, you may define the "From" values in your mail script.
Code:
Example:
//DEFINE SOME VARIABLES
$to = "$_POST[email];
$subject = "Your email subject line";
$message = "$_POST[message]";
$adminemail = "youremail@domain.com"
$website = "www.yourdomain.com";

// SEND THE EMAIL AS PER DEFINED VARIABLES
mail($to, $subject, $message, "From: $website <$adminemail>\n");
more and more hosts are dropping outgoing Email into the bit bucket if
the "from" address is not in your account
that is - they no longer allow outgoing email with forged headers

you should validate the " $_POST[....] " before you pass them on

you should also test the return value of the PHP function MAIL( ) for a error


Murphy's Eighth Law: If everything seems to be going well, you have obviously overlooked something.
Reply With Quote
(#4 (permalink))
Old
Banned
pulpfiction is on a distinguished road
 
Posts: 62
Join Date: Jun 2012
Default 06-18-2012, 06:43 PM

Yes, you definitely can customize it.

I would just make so it sends the mail to your email (admin@yoursite.com).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com