LinuxQuestions.org
Help answer threads with 0 replies.
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, 12:38 PM   #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 01:04 PM.
 
Old 08-30-2009, 12:45 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652
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, 05: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 05:26 AM.
 
Old 08-30-2009, 08:59 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652
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 09:03 AM. Reason: Exim reference
 
Old 08-30-2009, 11: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:14 AM
Debian etch - Unable to send mail from command line or from php mail command lqforumuser Linux - Newbie 1 03-01-2009 07:56 AM
Want to send mail with php mail() command - minimum config required? FeathersMc Linux - Server 2 10-26-2008 01:21 AM
to send mail with php Nau Linux - Software 3 02-28-2006 09: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 07:06 PM

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

All times are GMT -5. The time now is 07:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration