Setting SMTP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Setting SMTP?

Post by Steveo31 »

Windows XP, Apache, etc.

I was hoping that this was going to work, and it didn't. Kinda figured, but was worth a try :)

Anyway...

Code: Select all

mail("ShutterbugEOS31@aol.com", "Website", "$data");
returns this error:

Code: Select all

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\easyphp1-7\www\tester.php on line 43
Any ideas on how to do this? Or should I just hold off and not run commands like this from my machine?
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Hi
You have to d 2 things:

1) Check your smtp server, if you have none use the ISPs one or install one:
http://www.postcastserver.com/

2) Change the php.ini file in c:/windows:

Code: Select all

SMTP = smtp.server.com ; for win32 only
sendmail_from = me@myaddress.com ; for win32 only
;sendmail_path = ;for unix only, may supply arguments as well ; (default is sendmail -t)
that should do it !
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

you can do the following to make it somewhat easyer.. for as far as i remember it correctly.

There is a java package called James.. ( ill look in a bit where to get it)

just give me a sec....
_J_A_K_A_R_T_A__J_A_M_E_S___M_A_I_L__S_E_R_V_E_R


What is it?
-----------

JAMES is a 100% pure Java server application designed to be a complete,
portable and powerful enterprise mail engine solution based on currently
available open protocols (SMTP, POP3, IMAP, NNTP etc).

JAMES was formerly known as the Java Apache Mail Enterprise Server.

The Jakarta Project
http://jakarta.apache.org/
That should fix youre problems ;-)
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Thanks Dr. Evil. I saw that same advice on another's thread, so I did a search, and this is what I came up with. Heh.

Anyway, I installed the Postcast server, the SMTP it told me to have was "D6C3Z021", and so I changed the SMTP line in the php.ini file to that. So now it reads:

Code: Select all

їmail function]
; For Win32 only.
;was localhost
SMTP = D6C3Z021

; For Win32 only.
sendmail_from = me@localhost.com
But I believe the sendmail_from is incorrect, as the SMTP is set as D6C3Z021 but the "from" address here is me@localhost.com. Is that a problem?

Thanks for your help.

@ ol4pr0:

I went to the link, thanks. The only prob is the files to download are not for windows, right? The whole tar.gz and mp5 files...

-Steve
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Make sure the host name in the postcast settings system tab is the same as the one specified in the php.ini file.

The sendmail_from can be your email address.

If you have a firewall make sure it's not blocking your postcast server.

Show us the error ! ( to check it worked don't forget to do a refresh in postcast)
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Thanks for keepin with me on this Dr.

Here's the specs in the SMTP settings:

Host Name: D6C3Z021
Port: 25

And the PHP.ini file:

Code: Select all

їmail function]
; For Win32 only.
;was localhost
SMTP = D6C3Z021

; For Win32 only.
sendmail_from = ShutterbugEOS31@aol.com
And the error:

Warning: mail(): Failed to connect to mailserver at "D6C3Z021" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\easyphp1-7\www\tester.php on line 92

I'm assuming that the PostCast server has to be open to get it to work, right? Do I have to make and send a "new" message inside PostCast to open the connection or somethin?

Thanks again.
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Yes PostCast must be running. The error you get is typical of php not finding the server.
Change the name of the server in php.ini and postcast config (ie computer name)

The setting is certainly wrong in postcast
Last edited by Dr Evil on Mon Mar 01, 2004 2:26 am, edited 1 time in total.
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Excellent man, so far I'm not getting an error, but I'm not getting mail either. Could it be AOL blockin it or something? I know AOL is pretty touchy about that kinda stuff.

Dr.- what is your email config like? Do you use Outlook Express? I would like to, it seems pretty easy, but I don't know AOL's POP3 and SMTP settings, which I need for Outlook to get setup, right?

Thanks a lot man. Lifesaver you are.

:)
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Oh jeez....! Nevermind man, email arrived. I was lookin in the wrong program. Doh! Thanks a TON Dr. Evil.
JennFish
Forum Newbie
Posts: 5
Joined: Fri Mar 05, 2004 9:05 pm

Post by JennFish »

Ahh! Similar problem... okay, PostCast is running fine -- I can send e-mails from the program itself. Settings in PostCast indicate the host name is JENN server port 25.

My php-ini file:

Code: Select all

; For Win32 only.
SMTP = JENN

; For Win32 only.
;sendmail_from = heyjupiter_us@yahoo.com
My php code:

Code: Select all

mail("heyjupiter_us@yahoo.com","Test Subject","Test Message");
And, finally, the error:

Code: Select all

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\Apache Group\Apache2\htdocs\ftmc\registry_confirmadd.php on line 104
Any ideas? Thanks in advance! :)
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Have you restarted your servers ?
What happens if you try:

Code: Select all

<?php
mail("heyjupiter_us@yahoo.com","Test Subject","Test Message", "From: heyjupiter_us@yahoo.com");
?>
JennFish
Forum Newbie
Posts: 5
Joined: Fri Mar 05, 2004 9:05 pm

Post by JennFish »

Dr Evil wrote:Have you restarted your servers ?
What happens if you try:

Code: Select all

<?php
mail("heyjupiter_us@yahoo.com","Test Subject","Test Message", "From: heyjupiter_us@yahoo.com");
?>
Thanks for the suggestions, Evil, but no dice. I pasted the suggested code in to no avail, and then restarted Apache and still nothin'. :(

Any other ideas? :?
JennFish
Forum Newbie
Posts: 5
Joined: Fri Mar 05, 2004 9:05 pm

Post by JennFish »

In trying to find some sort of answer, I tried the following code:

Code: Select all

<?php
echo("SMTP = " . ini_get("smtp"));
?>
... I thought this would show me what I had set up in the php.ini file... ? Instead it showed SMTP =.

8O :?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

<?php phpinfo() ?>
...will show you your php.ini settings (amongst other things).
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Kinda late.. however JAMES is also there for windows ( or atleast it should be )
Post Reply