Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 39442  / 2 Years ago, sun, january 9, 2022, 8:20:48

I've been trying for 2 whole days now, and I just can't get the most simple thing to work.



The problem: Sending eMails from PHP to my eMail address does not work



I've been working with Windows and Sendmail (Sendmail was within the XAMPP package) before and everything was OK. The XAMPP-package (1.7.7) for Linux doesn't have Sendmail integrated though. So after googling around a little I found out that Postfix fits better into a LAMPP-environment.






What I have tried so far:



I've installed Postfix and wanted to configure it to just use the smtp-server of my private eMail provider (like it did on Windows). So I've confogured my php.ini like this:



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

; For Win32 only.
;sendmail_from = [email protected]

sendmail_path = /etc/postfix
mail.add_x_header = On


Note that I've commented out the "Win32 only"-stuff. The /etc/postfix/main.cf Looks like this:



smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
sender_canonical_maps = hash:/etc/postfix/sender_canonical
mydestination = ubuntu, localhost.localdomain, localhost
relayhost = mail.gmx.net
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only


/etc/aliases is unchanged:



# Required aliases
postmaster: root
MAILER-DAEMON: postmaster

# Common aliases
abuse: postmaster
spam: postmaster


/etc/postfix/sasl_password:



my.providers.smtp my_login:my_password


/etc/postfic/sender_canonical:



postmaster [email protected]





What happens:



So when I do



> sudo /etc/init.d/postfix start


everything seems to work fine and the /var/log/mail.log says: "ubuntu postfix/master[9720]: daemon started -- version 2.8.5, configuration /etc/postfix"



But when I run my PHP-script (which worked fine with Windows and Sendmail), it just runs through and nothing happens, not even an error is logged.






What I actually want to achieve:



I'm working locally on an e-commerce website. It runs fine on the dedicated webserver, but I want to also have it running locally for obvious reasons. In some cases, it sends emails, and I just want to be able to receive them with Thunderbird or in any other way. Is using Postfix overkill here? I don't need to receive emails - I just want to make the sent mails visible somehow. I could not seem to find any helpful step-by-step-tutorials for this issue (neither concerning Senmail nor Postfix - but, to be honest, I'm very new to Linux).


More From » php

 Answers
7

In your php.ini, this:



sendmail_path = /etc/postfix


Should be the path to the sendmail (or compatible) binary.

You've set it to the configuration directory of postfix which isn't right.



For historical reasons, usually /usr/bin/sendmail is maintained as a compatibility link.

sendmail was around first (I guess) and pretty much everything just assumes it is in the installed MTA. So when it isn't, the replacement makes a symlink so that nothing breaks.


[#41434] Monday, January 10, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
earxcept

Total Points: 310
Total Questions: 115
Total Answers: 111

Location: Japan
Member since Sat, Oct 2, 2021
3 Years ago
;