Mail Function

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

Post Reply
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Mail Function

Post by Love_Daddy »

Hi guys,

When I'm using mail in PHP it doesn't where I send it.
What can it be a problem? :D
User avatar
Phirus
Forum Commoner
Posts: 37
Joined: Thu Apr 18, 2002 4:10 pm
Contact:

Post by Phirus »

Dont understand your question please expand...


Phirus
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

:lol:
I'm using the PHP Mail Function of which I need to send an e-mail to myself.
But It doesn't return any error but never sends the e-mail to me either.
Or any other e-mail address that I specify..

I know the format is:
Mail ("To","Subject","Message")

Hope I've explained much better..
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

When you ask a question on the forum you are more likely to actually get the help you need if you explain the problem clearly including any relevant code that you are using (please narrow this down to the part of the script causing problems), any error messages that you are receiving and a description of what is actually happening when you use the script and what you expect to happen.

That said:
Have you checked that the SMTP and sendmail_from values (if you are using Windows) or the sendmail_path (if you are using *nix) in your php.ini are correct?

Mac
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

I'll remember that next time, thanks.
Okay I've edited my php.ini file and in my SMTP option this is what I've found.

[mail function]
SMTP = localhost ;for win32 only
sendmail_from = me@localhost.com ;for win32 only;
sendmail_path = ;for unix only, may supply arguments as well (default is sendmail -t)

I'm not sure what to do for it to work properly.
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

Mail function !

Post by gite_ashish »

Hi,

For details regarding the configuratin (what, why... etc) see the PHP man:

:idea: http://www.php.net/manual/en/function.mail.html

It's really simple, give it a try man !!

Regards,
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

Post by gite_ashish »

Hi,

Actually, the link for config details is as below:

http://www.php.net/manual/en/ref.mail.html

And see the section Mail Configuration Directives.

The earlier posted link is for mail() function details and not for config details... sorry for that :oops:

[mail function]
SMTP = localhost ;for win32 only
sendmail_from = me@localhost.com ;for win32 only;
sendmail_path = ;for unix only, may supply arguments as well (default is sendmail -t)
* The first (SMTP = ) and second (sendmail_from = ) parameter are needed if you are using php on win32 platform (win nt/2000/xp)
* The third (sendmail_path = ) parameter is needed if you are using php on *nix (linux,solaris,*bsd...etc)

If you are using red hat linux 6.x/7.x with default installation:
sendmail_path = /usr/sbin/sendmail
should work fine !

Let us know what platform u r using to run php and go through the php man url given above.

Regards,
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

Will do.
User avatar
Phirus
Forum Commoner
Posts: 37
Joined: Thu Apr 18, 2002 4:10 pm
Contact:

Post by Phirus »

You have to us an SMTP server, unless you are running one on your local machine, which I doubt you are.

I would use whatever SMTP server you use when sending your own email through a mail client (e.g - Outlook, NN Messenger, Moz Mail etc)

Hope that helps ya somewhat,

Phirus
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

Oh, I'm on Postfix...
How does that work anyway?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Probably best to look at the configuration settings then:
http://www.postfix.org/basic.html#myorigin

Another thing you may be able to do is ask the administrator of the web server (obviously this is a moot point if that's you) what the name or IP address of your SMTP server is. Or ask your ISP what setting you should use for SMTP.

Mac
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

Post by gite_ashish »

hi,

if you r running postfix (on red hat linux 6.x/7.x), setting following in php.ini should work
sendmail_path = /usr/sbin/sendmail

while executing your php script, which contains mail() function, see the mailog also:

Code: Select all

tail -f /var/log/maillog
if running on solaris, i think the path need to be /var/adm/maillog. generally maillog file is readable to everyone.

regards,
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It probably would make it a lot easier to offer help if you did actually tell us which OS and webserver you are using.

Mac
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

Well, I'm on Mandrake Linux 8.2 and apache/postgreSQL and PHP
and yesterday, I tried installing sendmail and it told me that I'm postfix..
Post Reply