Sending Email from PHP in Ubuntu Desktop

Re: Path of Sendmail
Open synaptic and search for sendmail. Then install it from there.

Sendmail will then be found in /usr/sbin/sendmail

; For Win32 only.
;sendmail_from =

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = /usr/sbin/sendmail -t -i

or possibly:
sendmail_path = /usr/sbin/sendmail -i -t
sendmail_path = /usr/lib/sendmail -i -t

MY PHP.INI file is located in /etc/php5/apache2

I go into TERMINAL and type

sudo gedit
It prompts me for the root password
and then I am in gedit with superadmin rights and I can navigate to the php.ini file and change it. The very first thing I ever did was to open php.ini and do SAVE AS to original.php.ini so I can always revert back to the default.

NOTE: THE synaptic mgr install of POSTFIX will remove SENDMAIL.
what worked for me was:
apt-get install postfix

and then edit php.ini
Relevant lines in /etc/php5/apache2/php.ini:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from =

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = /usr/sbin/sendmail -t -i

and edited /etc/postfix/ and put my correct external smtp server
relayhost =

restart the services that had configuration changes

During the postfix installation, I chose the Internet Configuration. If you hover the mouse over the choice field, a tool tip will explain all the choices. I noticed that it offered me bryan-desktop as a name for the system, so I stuck with that, since it might be required, and I have no idea how to find the name of my system.

Now all I need to do is TERMINAL sudo gedit

and edited /etc/postfix/ and put my correct external smtp server
example – relayhost =

(but mine will I THINK be

restart the services that had configuration changes

OF COURSE, the first thing I do when I gedit is to
SAVE AS, close, and reopen

When I make the above mentioned chage to the file, I find:

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.


There are some significant differences between the Debian Postfix packages,
and the source from upstream:

1. The Debian install is chrooted by default.
2. Dynamically loadable map support.
3. For policy reasons:
a. SASL configuration goes in /etc/postfix/sasl
b. myhostname=/path/to/file is supported (and used) in
4. smtp_line_length_limit defaults to 0, instead of 990, in absolute
violation of the RFC. Note that mailers in the path will still
potentially split the line, though. This will be removed at some
point in the future.
5. IPV6 support is enabled: postfix listens on ipv6/ipv4 by default,
(see: inet_protocols)
6. TLS/SASL support is enabled.
7. rmail comes from sendmail, not from postfix.
8. The upstream is delivered as /usr/share/postfix/,
rather than cluttering /etc/postfix/ with comments.

Known caveats:
1. The dynamically loadable modules are not found in the chroot.
Therefore, proxy maps may require you to copy the appropriate shared
object into the chroot if you chroot the proxy service in
2. Some map types (and SASL support) require some extra configuration
(beyond what upstream indicates) to run inside the chroot. The simplest
solution for the maps is to use the proxy service, which is not chrooted.
SASL is a bit more complex, and is on the TODO list…
3. Note that the chrooted daemons open /dev/log before chrooting, so if your
syslog daemon is restarted, the daemons will be unable to reconnect to the
syslog socket, and hence being unable to log. The postfix package provides
a config snipped for the rsyslog daemon in /etc/rsyslog.d/postfix.conf to
also open a socket in /var/log/postfix/dev. For other syslog daemons, you
will also have to restart postfix after restarting the syslog daemon, or
configure it to open an additional socket.
a. For sysklogd (the default in Debian versions prior to Lenny), add
SYSLOG=”-a /var/spool/postfix/dev/log” to /etc/default/syslog.
b. For inetutils-syslogd, add SYSLOGD_OPTS=”-a /var/spool/postfix/dev/log” to



Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: