Has anyone sent email with php mail function installing postfix mail server?

Has anyone sent email with php mail function installing postfix mail server ?

Please post you /etc/postfix/main.cf .

Please elaborate/explain with example how you did and what you did .

Email will be sent to any email address from ‘no-reply@yourhomelocaldomain.com’ .

I have searched in google but could not find any solution .

Here is my /etc/postfix/main.cf

myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_auth_only = no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

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

myhostname = mail.myriderdomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myriderdomain, localhost.$myriderdomain, localhost
relayhost =
mynetworks =
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4

hostname = mail.myriderdomain.com
/etc/mailname = mail.myriderdomain.com
/etc/aliases = root:user1

I tried ,

mail -s 'subject' xxx@xxx.com

Nov  5 13:16:39 mail postfix/smtp[7163]: DBC468AAA4: to=<xxx@xxx.com>, relay=none, delay=56061, delays=55956/0.02/105/0, dsn=4.4.1, status=deferred (connect to mta7.am0.yahoodns.net[]:25: Connection timed out)

Can anyone help me to fix this error ?

(connect to mta7.am0.yahoodns.net[]:25: Connection timed out)

Seems to indicate that your server is unable to reach the requested DNS server - is it being blocked?

May be it’s blocked.
How can i check if it’s block or not ?

The stock postfix main.cf is more than enough to allow PHP to use its mail function to send mail.

I use this on multiple servers, though i often do tune the config.

The issue looks to be that port 25 outbound is being filtered, is this server in a datacenter or on a home broadband connection? If so, which ISP?

I know in the UK, as an example, a LOT of ‘home’ ISPs block outbound port 25, they must relay through one of their controlled SMTP servers.

In which case, if you haev your ISP’s details you can easily set postfix to relay.

Yes , 25 port is blocked. But the mail.isp.com with 465 port smtps is running , How can i relay through it ?

You want to use the “relayhost” configuration option, this tells postfix where is the upstream server to send to.

relayhost = [mail.isp.com]:465

(the force postfix to do an MX record lookup, making sure mail goes the right way)

Don’t you have to create sasl_passwd for relayhost = [mail.isp.com]:465 ?

And the port 465 is for smtps. So i get some error for this port . It can’t relay email.

Have a look at http://wingloon.com/2008/06/21/setup-relay-host-port-and-smtp-authentication-client-in-postfix/

The link you gave used 2525, but my mail.isp.net uses 465 port and it’s smtps not smtp . It’s a special port. How can i handle this for relayhost ?

Same principles apply, just change the options to suit your configuration / setup :slight_smile:

Are you telling me to change only the port number from 2525 to 465 ?

Yep :slight_smile: change the port, update any sasl details to match those for your account.

What did you mean by options ? Which options to change ?