Visit The New, Modern Unix Linux Community

How to send mail (sendmail) for php mail()?

Thread Tools Search this Thread
Special Forums IP Networking Proxy Server How to send mail (sendmail) for php mail()?
# 1  
Blade How to send mail (sendmail) for php mail()?

PHP mail() function doesn't work.

Nor does sendmail:
loaded system configuration file /etc/msmtprc
ignoring user configuration file /home/xi/.msmtprc: No such file or directory
falling back to default account
using account default from /etc/msmtprc
host = xsi
port = 25
proxy host = (not set)
proxy port = 0
timeout = off
protocol = smtp
domain = localhost
auth = none
user = (not set)
password = (not set)
passwordeval = (not set)
ntlmdomain = (not set)
tls = off
tls_starttls = on
tls_trust_file = (not set)
tls_crl_file = (not set)
tls_fingerprint = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = on
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from =
add_missing_from_header = on
add_missing_date_header = on
remove_bcc_headers = on
dsn_notify = (not set)
dsn_return = (not set)
logfile = (not set)
syslog = LOG_MAIL
aliases = (not set)
reading recipients from the command line and the mail

cat /etc/ssmtp/ssmtp.conf

# Example for a system wide configuration file
# A system wide configuration file is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default
# The SMTP smarthost.
host xsi
# Construct envelope-from addresses of the form "user@oursite.example".
#auto_from on
#maildomain oursite.example
# Use TLS.
#tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
syslog LOG_MAIL

xi@xsi ~ $ cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /usr/share/doc/openrc*/net.example* and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth0=" brd"
routes_eth0="default via"
# The network scripts are now part of net-misc/netifrc
# In order to avoid sys-apps/openrc-0.12 from removing this file, this comment was
# added; you can safely remove this comment.  Please see
# /usr/share/doc/netifrc*/README* for more information.

xi@xsi ~ $ cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /usr/share/doc/openrc*/net.example* and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth0=" brd"
routes_eth0="default via"

How to send via sendmail without any other outer mail? I just want to send by testing sendmail on command line. Which minimum amount of setup work do I have to do (generally)?

sendmail -f "" -vt <mail.txt
xi@xsi ~ $ cat mail.txt
To: ***
Subject: Put a subject here

(I don't really need any email-server
I need activation email with php, thanks)

Who's got working mail() via sendmail? How did you set it up to work?

I was advised to use msmtp. As far as I could see some people defend the position of setting up the outer mail. I don't know it - how it's called "relay ".. I don't need it IF IT'S POSSIBLE. Another wide-spread opinion in google search results is to ask a provider to write a PTR record into outer DNS zone.
I HOPE NOT and hope I will silently send my activation hash to user's email after registration from my peaceful home without disturbing any providers support or other services.

(Gentoo Linux)
I'm waiting for your help, I wish the way of learning sendmail and php mail() will be just full of just-needed information ...PHPmailers.. libraries - rather not.
However, you might prove to me that's simply just to learn email protocol and write my own php..
(like it was on #gentoo channel:
17:11 < xsi> How to send via sendmail without any other outer mail? Which minimum amount of setup work do I have to do
17:11 < Cheaterman> Also if what you need is Arch, just use it x) anyways.
17:11 < Cheaterman> xsi: With sendmail? very little
17:11 < xsi> )
17:11 < Cheaterman> You don't wanna use it to receive e-mails do you?
17:11 < xsi> no
17:11 < Cheaterman> Then you should be fine
17:11 < Cheaterman> Merely install the thingy and you should be good to go xsi

I'm such a green newbie even in js ..guys.. PHP xD .. and apart I see the immense fields of standards huge & cumbersome


1. What to write in each config php.ini httpd.conf ssmtp.conf
2. What parameters to write to sendmail to just test
3. What I must put into other system-wide config files?

Last edited by Xcislav; 02-05-2015 at 12:31 PM..
# 2  
sendmail on your system is just ssmtp.

ssmtp won't work until you configure it. See all those 'not sets'? They're not set.

You need to set at least 'mailhub', 'AuthUser', and 'AuthPass' in ssmtpd.conf for it to try to connect to a mail server. What those are, depends on what email and mail server you want it to connect to.
This User Gave Thanks to Corona688 For This Post:

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #13
Difficulty: Easy
EBCDIC, ASCII, SIXBIT, and ANSI are methods for encoding text characters on a computer.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. UNIX for Dummies Questions & Answers

Configure sendmail to Only send mail to one domain

On both Solaris 10 and RHEL, we would like to configure sendmail in such a way that the email sent from the server should only go to a particular domain. For eg. We want our server to ONLY send the mail to <user_name> All other domains should be blocked/restricted. The server should not... (0 Replies)
Discussion started by: sk2code
0 Replies

3. Shell Programming and Scripting

How to send mail using PHP mail function On apache server.?

Hello, I am using centos-6.2 I have apache server,php5 on my system and I want to send mail using sendmail on my system. when I try to send mail from shell that time mail is succesfully sent to respective address() but when I try to send it through webbrowser I am not able to send it.... (1 Reply)
Discussion started by: Kiran ursal
1 Replies

4. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies

5. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

6. AIX

Able to send mail without running MTA (sendmail)?

Hi, I am facing a (for me and coworkers) strange behaviour. When I stop sendmail on a plain AIX 5.3 testing box (there is definetly no sendmail process left running anymore), I am still able to send mails to remote addresses via the mail command. I tried that on another box which is not a... (6 Replies)
Discussion started by: zaxxon
6 Replies

7. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

8. Shell Programming and Scripting

Pull E-mail address from file, send e-mail

Hello, I am new to perl and need to create a script that will read a file and pull a name from the file and send e-mail. How can I use the following awk statement in a perl script? grep UNIXadmins /root/mail.conf | awk '{ print $2}' and use the output to send a e-mail. Any help would... (1 Reply)
Discussion started by: DC Heard
1 Replies

9. UNIX for Dummies Questions & Answers

I am not able to send mail form unix to other mail accounts.

Using Mailx command i.e mailx -s "subject" < \tmp\chin this command executed sucessfully but not able to receive the mail in please help. (1 Reply)
Discussion started by: chinnigd
1 Replies

10. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies

Featured Tech Videos