Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6887875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:56:17+00:00 2026-05-27T05:56:17+00:00

I am using centos Server and have to send the mail to the user

  • 0

I am using centos Server and have to send the mail to the user so i copied running code of mine from one server and used it in here, but it is not sending mails.

Code is :

                $to = $email; //writing mail to the user
                $subject = "Hii";
                $message = "<table>
                <tr><td> Hello ".$email.",</td></tr>
                <tr><td> Some Text </td></tr>
                <tr><td> Some Text </td></tr>
                <tr><td> Some Text </td></tr>
                <tr><td> Some Text </td></tr>
                </table>" ;
                $from = "example@domain.com";
                // To send HTML mail, the Content-type header must be set
                    $headers  = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                // Additional headers
                $headers .= 'From: Team <example@domain.com>' . "\r\n";

                if(mail($to,$subject,$message,$headers))
                {
                    echo "0";// mail sent Successfully.
                }
                else
                {
                    echo "1";
                }

It always print 1. Same code running fine on other project. Please guide me what i can do to enable it here too?
Any help will be highly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:56:18+00:00Added an answer on May 27, 2026 at 5:56 am

    After installing sendmail* and running the following commands:

    [root@sendmail ~]# yum install sendmail*
    [root@sendmail mail]# yum install dovecot
    [root@sendmail mail]# cd /etc/mail/
    [root@sendmail mail]# vi local-host-names
    # local-host-names - include all aliases for your machine here.
    example.com
    [root@sendmail mail]# vi /etc/dovecot.conf
    protocols = imap pop3 //uncomment
    [root@sendmail mail]# m4 sendmail.mc > sendmail.cf
    [root@sendmail mail]# make
    [root@sendmail mail]# /etc/init.d/sendmail start
    [root@sendmail mail]# /etc/init.d/saslauthd start
    [root@sendmail mail]# /etc/init.d/dovecot start
    [root@sendmail mail]# chkconfig sendmail on
    [root@sendmail mail]# chkconfig dovecot on
    [root@sendmail mail]# chkconfig saslauthd on
    

    I still had the same issue. I checked my /var/log/maillog and saw an error:

    My unqualified host name (domain) unknown; sleeping for retry
    

    After more searching, I changed /etc/hosts from:

    127.0.0.1     localhost localhost.localdomain domain
    ip.ip.ip.ip  domain localhost 
    

    to:

     127.0.0.1   localhost.localdomain localhost domain
     ip.ip.ip.ip  localhost domain  
    

    and now the mail function is now working fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have SSH access to a shared server (running centOS) and I want
I have php 5.1.6 running on my CentOS 5 server running Apache 2.2.3 I
I have a mail server based on Postfix + Dovecot (IMAP) on a CentOS
I have finished installing RabbitMQ using the following RPM http://www.rabbitmq.com/releases/rabbitmq-server/v2.7.1/rabbitmq-server-2.7.1-1.noarch.rpm i installed it like
I'm working on setting up a production server using CentOS 5.3, Apache, and Phusion
I'm trying to install redmine on a Centos server. I already have PHP and
I have recently installed Subversion onto a Linux server ( CentOS ) and everything
I have ImageMagick installed on my CentOS linux server. I am trying to get
I am running into the following error using Pear Mail: Notice: Error in sending
I have server (WHM, ruby 1.9.2, Rails 3.0.3, centOS, passenger) and I just deploy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.