Current location: Hot Scripts Forums » General Community » The Lounge » headache


headache

Reply
  #1 (permalink)  
Old 08-19-09, 09:06 AM
WillUK WillUK is offline
Wannabe Coder
 
Join Date: Jan 2009
Location: Beverley, England
Posts: 130
Thanks: 5
Thanked 2 Times in 1 Post
headache

Hi

Hopefully this will be an easy question to answer!

I am looking at publishing a site (my first site, excluding that of the office that I work for in fact), and I need to understand the processes at work behind the mechanics of web publishing.

More specifically, if I purchase pop-3 mail boxes through a particular ISP, say 123-reg.com, does that mean I am required to host the whole site through 123-reg.com too??? or am I free to look for site hosting elsewhere?

In particular, I am worried about the mail function consequences. Basically, I have built a standard contact form that currently works when the recipient's email address (set within the php code of sendmail.php file) is set to an address that is registered with the ISP that host's this office's web site e.g. myname@thiscompany.com

However, when I alter the recipient address (just to test) to an alternate address; one that is not purchased through this office's ISP e.g. hotmail/gmail or any other address (including pop-3), the mail is never received.

The implications of this are that only pop-3 mail boxes relating to where a site is hosted can be used in conjunction with a mail function (on site contact form).....This doesn't seem right to me.
Do I need to point the ISP that hosts the pop-3 mail boxes to the server that is hosting the site? If so, this doesn't explain why hotmail or gmail etc do not work.....

Please could someone clarify exactly what is going on here?

Thanks
Will
Reply With Quote
  #2 (permalink)  
Old 08-19-09, 10:13 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
You must remember that all email use a specific server and web pages (HTML) use a different server.
So your email uses a MAIL server and your web page uses an HTML server.

Now, if your MAIL and HTML servers are in the same domain, then when they setup their PHP, it automatically points to the MAIL server.
But if you have your MAIL server by a different host, then you will have to specify the SMTP server address in the php.ini file.
You can do this by using the ini_set() function in PHP. PHP: ini_set - Manual


Example:
PHP Code:

ini_set("SMTP","mail.someserver.com");
ini_set("smtp_port",25);
ini_set("sendmail_from","you@youremail.com"); 
__________________
Jerry Broughton
Reply With Quote
  #3 (permalink)  
Old 08-20-09, 07:06 AM
WillUK WillUK is offline
Wannabe Coder
 
Join Date: Jan 2009
Location: Beverley, England
Posts: 130
Thanks: 5
Thanked 2 Times in 1 Post
Thanks Jerry. That makes sense

Just two more questions:

1/ Does the sendmail_from address also have to be one that is registered with the mail server?

2/ Can the address for the $recipient (where the mail is dumped after the contact form has been submitted) be the same as the sendmail_from address or would this cause problems?

Cheers
Reply With Quote
  #4 (permalink)  
Old 08-20-09, 07:36 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
The important things are the SMTP and the smtp_port.
Usually the smtp_port is set to 25 by default, so you won't have to set that unless you need to change it.
sendmail_from is mandatory, but setting it in php.ini only defines it as the default.
It can also be set using the [string $additional_headers] in the mail() function.
See PHP: mail - Manual for clarification.
Also sendmail_from can be any address you choose.
But SMTP and smtp_port must match the SMTP server that you want to use.
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Include tree headache... Raconteur PHP 9 01-12-09 07:12 PM
[SOLVED] Regex Headache -[OnTarget]- PHP 1 01-06-09 11:40 AM
Unexpected headache from unexpected "T String" dcshoeco1 PHP 4 09-29-06 02:36 PM
Math headache hmhart1 JavaScript 3 03-24-05 05:58 AM
Selling Software, and big headache with fraud...Please help!!! ggmltd Script Requests 3 11-14-04 05:39 AM


All times are GMT -5. The time now is 03:18 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.