PHP Mail Function

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
BrandonK
-


Joined: 14 Apr 2005
Posts: 10

PostPosted: Thu Apr 14, 2005 9:51 pm    Post subject: PHP Mail Function Reply with quote

I'm trying to setup a few test scripts and I've gone though and put Abyss 2.0.0.20, mySQL and phpMyAdmin all up and running, no flaws. I've used php includes throughout the site and phpMyAdmin of course. The only problem is when I try to use php's mail function I get errors (all of the scripts have custom error messages so I don't really know what more info to give you); nothing ever goes through. Was there a specific parameter I was supposed to setup for the mail function? I had to forward port 80 through my firewall for the http, and I even disabled my firewall to try and send mail, nothing.

I'd be greatful to get this working!


Last edited by BrandonK on Fri Apr 15, 2005 5:08 am; edited 1 time in total
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Apr 14, 2005 9:55 pm    Post subject: Reply with quote

Your ISP may be blocking outgoing mail connections. Check with them to see if they block any ports.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Thu Apr 14, 2005 10:25 pm    Post subject: Re: PHP Mail Function Reply with quote

BrandonK wrote:
I'm trying to setup a few test scripts and I've gone though and put Abyss 2.0.0.20, mySQL and phpMyAdmin all up and running, no flaws. I've used php includes throughout the site and phpMyAdmin of course. The only problem is when I try to use php's mail function I get errors (all of the scripts have custom error messages so I don't really know what more info to give you); nothing ever goes through. Was there a specific parameter I was supposed to setup for the mail function? I had to forward port 80 through my firewall for the http, and I even disabled my firewall to try and send mail, nothing.

I'd be greatful to get this working!


You have set up a mail server etc, yeah?
(just checking)
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
BrandonK
-


Joined: 14 Apr 2005
Posts: 10

PostPosted: Fri Apr 15, 2005 4:09 am    Post subject: Reply with quote

No, unfortunately I didn't know how. I haven't set up anything beyond the PHP extension mySQL and phpMyAdmin. What mail server should I use?
Back to top View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Fri Apr 15, 2005 4:20 pm    Post subject: Reply with quote

BrandonK wrote:
No, unfortunately I didn't know how. I haven't set up anything beyond the PHP extension mySQL and phpMyAdmin. What mail server should I use?


This is really up to you, if your going to send mail youll want an SMTP server.
I use mail enable for POP3 and PostCast server for SMTP.
Then simply change the following lines in php.ini
Code:
SMTP = 127.0.0.1
smtp_port = 25

and change the port if you set it otherwise.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
BrandonK
-


Joined: 14 Apr 2005
Posts: 10

PostPosted: Sat Apr 16, 2005 4:18 am    Post subject: Reply with quote

Ok, did some more debugging. This is the error message I get
Code:
Warning: mail(): Failed to connect to mailserver at "127.0.0.1" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\webpages\localhost\htdocs\sendmail.php on line 6


My PHP.ini section looks like this
Code:
[mail function]
; For Win32 only.
SMTP = 127.0.0.1 ; for Win32 only
smtp_port = 25


I made sure that it is forwarded on my router and my firewall just like I had to do with port 80. In order to see if my ISP blocks 25 or not, I chose a random port number 25252 and changed it everywhere as needed, but I still get the same error message (port 25252 now, not 25 of course).

As I said earlier, I only have PHP installed, no special SMTP service. This is not a BIG ordeal because I just use this server for testing scripts and layouts before uploading them to a proper web server, but in a few weeks I'll be converting a Linux server to a 100% web server and I'm trying to learn as much now as possible so I don't have to screw up the Linux as I'm not proficient in that OS to begin with.

Anyone have any ideas? I'll be out of town for 3 days so if you guys just brainstorm I'll try it all when I get back.

Thanks ya!
Brandon!

EDIT: MonkeyNation, I just reread your post and I think you are saying that I need to install a seperate server just for emailing? If this is true, let me know -- I don't wanna go through the hassle just for this, but it's good to know. I had Abyss installed once before, long time back and I remember sending emails through a form -- I think asp, without installing a seperate server.
Back to top View user's profile Send private message
olly86
-


Joined: 25 Apr 2003
Posts: 993
Location: Wiltshire, UK

PostPosted: Sat Apr 16, 2005 10:06 am    Post subject: Reply with quote

It is possible to send the emails through your ISP's SMTP server, provided that it does not require authorisation.
_________________
Olly
Back to top View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Sat Apr 16, 2005 12:43 pm    Post subject: Reply with quote

BrandonK wrote:
EDIT: MonkeyNation, I just reread your post and I think you are saying that I need to install a seperate server just for emailing? If this is true, let me know -- I don't wanna go through the hassle just for this, but it's good to know. I had Abyss installed once before, long time back and I remember sending emails through a form -- I think asp, without installing a seperate server.


Yes, you do need to install a seperete mail server if you plan on sending email through php, or you can use an external SMTP server as olly68 said.
Im sure there may be some people that will allow you to use their SMTP server for free, ask around.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
Moxxnixx
-


Joined: 21 Jun 2003
Posts: 1226
Location: Florida

PostPosted: Sat Apr 16, 2005 6:40 pm    Post subject: Reply with quote

If your ISP is blocking port 25, a mail server won't do you any good.
Do as olly86 suggests and use the smtp settings that you use for your ISP email.
Put it in the [mail function] of your php.ini file.
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Sat Apr 16, 2005 6:57 pm    Post subject: Reply with quote

Moxxnixx wrote:
If your ISP is blocking port 25, a mail server won't do you any good.
Do as olly86 suggests and use the smtp settings that you use for your ISP email.
Put it in the [mail function] of your php.ini file.


Dont most ISPs require a login?
Unless there is a way to make php login.

And you could simply change the port on the server anyway.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
Moxxnixx
-


Joined: 21 Jun 2003
Posts: 1226
Location: Florida

PostPosted: Sat Apr 16, 2005 7:09 pm    Post subject: Reply with quote

Port 25 is the standard port number and while you can change the port number in the server to allow people to send the
messages internally, the remote servers always use port 25. There's no way around this except to use a socks proxy server.
This requires you to relay e-mail through other servers.

There is a way to make php send mail with authorization...
http://www.phpfreaks.com/tutorials/130/0.php
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Sat Apr 16, 2005 10:06 pm    Post subject: Reply with quote

Moxxnixx wrote:
Port 25 is the standard port number and while you can change the port number in the server to allow people to send the
messages internally, the remote servers always use port 25. There's no way around this except to use a socks proxy server.
This requires you to relay e-mail through other servers.

There is a way to make php send mail with authorization...
http://www.phpfreaks.com/tutorials/130/0.php


If he only plans on using the server locally then that dosent matter anyway does it? =S

But that tutorial should solve it for him :-)
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group