Results 1 to 3 of 3

Thread: can't send mail from localhost

  1. #1
    Join Date
    Jun 2011
    Beans
    50

    Question can't send mail from localhost

    I'm trying to send mail from localhost using the PHP mail function. My test script, which is simply a call to the mail function, works fine on my host, but not on my computer (localhost).

    I first tried sendmail, by editing the sendmail_path in php.ini like so:

    sendmail_path = /usr/sbin/sendmail -t

    That didn't seem to work. No email was received at my gmail account where I had tried to send the email. I checked the inbox and the spam folder. There was no error in my php log. In the mail log, I saw entries like this...

    Jan 12 09:58:04 ubuntu sendmail[3438]: q0CEw3DD003438: to=myemailaccount@gmail.com, ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30083, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q0CEw38b003439 Message accepted for delivery)

    ...where myemailaccount@gmail.com is my gmail address. I don't know how to read a mail log, but that entry looks pretty good to me, I suppose. However, I'm not seeing the email in my gmail account, and I've now waited a good while for it to show up.

    What might I be missing?

    Apologies if this is off topic for the ubuntu forum. I am using ubuntu, though I don't presume my problem here lies in how I'm using ubuntu. Not really sure.

  2. #2
    Join Date
    Jan 2008
    Beans
    1

    Re: can't send mail from localhost

    Try this site:
    http://sourcelibrary.org/2011/08/29/...x-lamp-server/

    I followed the steps, and it worked for me. You have to have LAMP installed first. And one other thing: When installing Postfix, click ok to everything, except 'System Mail Name." You set it to localhost.
    Last edited by tt8; January 22nd, 2012 at 07:46 AM. Reason: forgot one thing

  3. #3
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: can't send mail from localhost

    Quote Originally Posted by webcomm View Post
    I'm trying to send mail from localhost using the PHP mail function. My test script, which is simply a call to the mail function, works fine on my host, but not on my computer (localhost).
    ..........
    Jan 12 09:58:04 ubuntu sendmail[3438]: q0CEw3DD003438: to=myemailaccount@gmail.com, ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30083, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q0CEw38b003439 Message accepted for delivery)

    ...where myemailaccount@gmail.com is my gmail address. I don't know how to read a mail log, but that entry looks pretty good to me, I suppose. However, I'm not seeing the email in my gmail account, and I've now waited a good while for it to show up.

    What might I be missing?
    You do not "relay" through the same server you are sending from!

    A "relay" is an external SMTP server.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •