unable to setup mail server.

I have configured the server for my website. Now the problem is that mails are not sending from my server. I am using cakephp in my website. I tried setting up mail server also using following links:

https://www.georgebuckingham.com/blog/p … ail-ubuntu">https://www.georgebuckingham.com/blog/php-outgoing-mail-ubuntu

https://www.linode.com/docs/email/exim/ … -6-squeeze">https://www.linode.com/docs/email/exim/sendonly-mail-server-with-exim-on-debian-6-squeeze

but still i am unable to send mails from my server. Please help me setting up mail server.

When I try to send mail from command prompt then following error occurs.

root@monjardeal:~# echo "This is a test." | mail -s Testing gaganpreet@equasar.com

-bash: mail: command not found

7 Replies

Hey,

Try installing the mail application.

apt-get install mailutils

Hey p.woodman,

I have tried installing the mail application using the command given above. Now when i execute the following command

root@monjardeal:~# echo "This is a test." | mail -s Testing gaganpreet@equasar.com

then error is removed which was coming previously but still mail is not being sending from command prompt as well as from my project. Please help.

What does your mail server's log file say?

Following is the content of mail log file of my server.

Aug 21 12:34:58 monjardeal postfix/qmgr[29724]: 33D62101B9: from=<www-data@monjardeal.com>, size=355, nrcpt=1 (queue active)

Aug 21 12:34:58 monjardeal postfix/qmgr[29724]: 4ACFD101B8: from=<root@monjardeal.com>, size=351, nrcpt=1 (queue active)

Aug 21 12:34:58 monjardeal postfix/smtp[847]: warning: relayhost configuration problem

Aug 21 12:34:58 monjardeal postfix/smtp[848]: warning: relayhost configuration problem

Aug 21 12:34:58 monjardeal postfix/smtp[847]: 33D62101B9: to=<gaganpreet@equasar.com>, relay=none, delay=306, delays=306/0.02/0.02/0, dsn=4.3.5, status=deferred (Host or domain name not found. Nam$

Aug 21 12:34:58 monjardeal postfix/smtp[848]: 4ACFD101B8: to=<gaganpreet@equasar.com>, relay=none, delay=21465, delays=21465/0.01/0.02/0, dsn=4.3.5, status=deferred (Host or domain name not found.$

The lines are being lopped off, which is making it difficult to read the entire error message. But, "relayhost configuration problem" is telling. What is your relayhost set to in main.cf?

Relayhost is set to "smtp.localdomain" in main.cf file.

relayhost = smtp.localdomain

I have changed the values of "mydestination " and also commented out the "relayhost" in main.cf. After making these changes my mail function is working.

Thanks for your help hoopycat :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct