LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-28-2009, 11:38 AM   #1
albinworld
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Rep: Reputation: 0
What do I need to send a mail from php?


I'm building a server from scratch (Ubuntu 8.10) and I can´t send emails from PHP (no error, but no mail sended).

I've instaled mailutils (apt-get install mailutils) which installed the following packages: exim4 exim4-base exim4-config exim4-daemon-light guile-1.8-libs libgsasl7 libmailutils1 libntlm0

Do I need anything more?

What's happending? What test can I do?

Thanks in advance,
- Albin

More info:
# mailx -s Test -t albinworld@gmail.com
Cc:
Hi Albin!
.

doesn´t crash but doesn´t send anything

# mailx -s Test -t root
Cc:
Hi Albin!
.

same behaviour.

Last edited by albinworld; 08-28-2009 at 12:04 PM.
 
Old 08-29-2009, 11:45 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hi albinworld,

An easy test to start off:

'netstat -tnlp' look for something listening on port 25

example output:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1560/master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1503/sshd


Anything there ?

cheers
 
Old 08-30-2009, 04:22 AM   #3
albinworld
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks kbp,

Yes, there is exim4 listening

Protocolo Recv-Q Send-Q Dirección Local Dirección Externa Estado PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* ESCUCHAR 27969/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* ESCUCHAR 24668/apache2
tcp 0 0 0.0.0.0:21 0.0.0.0:* ESCUCHAR 3352/proftpd: (acce
tcp 0 0 87.98.151.88:53 0.0.0.0:* ESCUCHAR 3073/named
tcp 0 0 94.23.38.163:53 0.0.0.0:* ESCUCHAR 3073/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* ESCUCHAR 3073/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* ESCUCHAR 3098/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* ESCUCHAR 6746/exim4
tcp 0 0 127.0.0.1:953 0.0.0.0:* ESCUCHAR 3073/named

Next suggestion? please ...

- Albin

Last edited by albinworld; 08-30-2009 at 04:26 AM.
 
Old 08-30-2009, 07:59 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hey Albin,

You'll need to get exim working first going by this:

Quote:
# mailx -s Test -t albinworld@gmail.com
Cc:
Hi Albin!
.

doesn´t crash but doesn´t send anything

# mailx -s Test -t root
Cc:
Hi Albin!
.

same behaviour.
Once you have a functioning MTA you will need to check your php.ini email configuration, look for the section '[mail function]' and the settings should look something like:

SMTP = localhost
smtp_port = 25

Reference for Exim troubleshooting:
http://wiki.exim.org/TroubleShooting

cheers,

kbp

Last edited by kbp; 08-30-2009 at 08:03 AM. Reason: Exim reference
 
Old 08-30-2009, 10:08 AM   #5
albinworld
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks kbp,

Your link bring me to know swaks, then I looked at the log and I saw that the queue has messages frozen because mailing to remote domains was not supported, then I found the command 'dpkg-reconfigure exim4-config' and then I configured exim to work as 'Internet site'.

All done.
Thanks for the inspiration.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to send mail attachement using PHP another 1 Linux - Server 1 04-24-2009 03:14 AM
Debian etch - Unable to send mail from command line or from php mail command lqforumuser Linux - Newbie 1 03-01-2009 06:56 AM
Want to send mail with php mail() command - minimum config required? FeathersMc Linux - Server 2 10-26-2008 12:21 AM
to send mail with php Nau Linux - Software 3 02-28-2006 08:39 PM
Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10 arcanum Linux - General 3 06-27-2004 06:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration