Php postfix php ini

forum.lissyara.su

Как заставить postfix принимать почту и класть ее в файл?

Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.

Как заставить postfix принимать почту и класть ее в файл?

Поставил postfix. Наладил отправку. А как мне теперь принять почту? И как вообще проверить, в чем загвоздка. Как итог мне нужно принять почту для всех несуществующих пользователей (*@site.ru) и для начала записать ее в файл.

NOQUEUE: reject: RCPT from forward20.mail.yandex.net[95.108.253.145]: 454 4.7.1 .
disconnect from forward20.mail.yandex.net[95.108.253.145]
connect from forward20.mail.yandex.net[95.108.253.145]

Отправлено спустя 30 минут 54 секунды:
telnet localhost 25
Trying ::1.
Connected to localhost.
Escape character is ‘^]’.
220 sd1234-02.keymachine.de ESMTP Postfix (Ubuntu)
421 4.4.2 sd1234-02.keymachine.de Error: timeout exceeded
Connection closed by foreign host.

Услуги хостинговой компании Host-Food.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Alvares прапорщик Сообщения: 485 Зарегистрирован: 2008-07-10 12:48:08 Откуда: Воронеж Контактная информация:

Как заставить postfix принимать почту и класть ее в файл?

Как заставить postfix принимать почту и класть ее в файл?

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:$/smtpd_scache
smtp_tls_session_cache_database = btree:$/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = sd1234-02.keymachine.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.site.ru, sd1234-02.keymachine.de, localhost.keymachine.de, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
luser_relay = login
local_recipient_maps =
virtual_alias_maps = hash:/etc/postfix/virtual_maps

Отправлено спустя 52 минуты 20 секунд:
В файле virtual_maps

Источник

Is it possible to instruct PHP to use postfix configuration in php.ini?

I have postfix set up on Centos 6.4 I am not very familiar with E-mail servers or PHP, but I would like to set up a simple sight to send emails using postfix. Question: I have two servers, one is the email server and the another one is the web server, but I have an application that needs to send emails and for that I am using phpmailer, at the beginning I used gmail and worked fine, but now I have to use my own email server, in that server is running postfix

Читайте также:  Сумка из голубого питона

Is it possible to instruct PHP to use postfix configuration in php.ini?

Is it possible to configure PHP to send email using the configuration set for postfix?

WordPress (via PHPMailer) relies on these settings to be correct in php.ini:

;SMTP = localhost ; http://php.net/smtp-port ;smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = me@example.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "/usr/sbin/sendmail -t -i" ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. mail.log = /var/log/mail.log ; Log mail to syslog (Event Log on Windows). ;mail.log = syslog 

Postfix is configured to use Google’s SMTP server and confirmed as working at the OS (Ubuntu 14.04) level

PHPMailer fails (from WordPress) with the error:

Could not instantiate mail function.

Turns out because I was using php-fpm, there were settings I wasn’t aware were set living in /etc/php5/mods-available/zzzz_custom.ini.

Adding the sendmail path to that file worked for me :

sendmail_path=/usr/sbin/sendmail -t -i 

Php — Piping Email with Postfix, From the Postfix aliases(5) man page:. o An alias definition has the form name: value1, value2, The name is a local address (no domain part).Use double quotes when the name contains any special characters such as whitespace, #’,:’, or `@’.The name is folded to lowercase, in order to make database lookups …

Send mail using php and postfix

Thank you for taking the time to review my question. I have postfix set up on Centos 6.4 I am not very familiar with E-mail servers or PHP, but I would like to set up a simple sight to send emails using postfix. I was told I should use php. My current. (not working) source code is this.

    #mainContainer < position: absolute; top: 0; right: 0; bottom: 0; left: 0; >#adressContainer < width:100%; height:3%; >#buttonContainer < width:100%; height:5%; >#bodyContainer < width:100%; height:90%; >#address < resize:none; width:100%; height:100%; >#bodyText  --> 
send

PHP runs on the server. onClick executes Javascript on the CLIENT machine. You can NOT directly invoke PHP functions via Javascript code, or vice versa.

What you’re doing can be accomplished with a simple form:

There is no need to use Javascript at all.

Sendmail — How to use Postfix on my PHP code?, I have configured the Postfix successfully and was able to send email using mail -s «Test subject» recipient@domain.com The problem is on my Php code or configuration, when I click on the button which has the code in sending email notification it says Message Sent but I have not receive any email. My php code is :

Читайте также:  Python class return object

PHP how to check whether postfix is on

Is it possible to check in PHP, whether postfix service is running or not? I am looking for platform independent solution (so I don’t want to execute console commands within PHP code).

When I am testing my apps on localhost I often forget to start postfix and then I am curious, why I am not receiving emails :)). I would like to test somehow if service is enabled and throw an exception if not.

I don’t think its possible. The only thing you can do I think is something like try(mail()) but that will just check if the mail is sent and not if the mail has reached his target.

Anyways, you can simply use execute commands

When you want to have it cross-platform you can just access the PHP constant

which gives you the information about what operating system your running on. Then just execute different exec() commands for each operating system and your done =).

Lamp — Sending mails with PHP, LAMPP and PostFix, 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.

Phpmailer with postfix

I have two servers, one is the email server and the another one is the web server, but I have an application that needs to send emails and for that I am using phpmailer, at the beginning I used gmail and worked fine, but now I have to use my own email server, in that server is running postfix but I can get it work

Here is my phpmailer code

public function __construct() < < $this->mail = new PHPMailer(); $this->mail->isSMTP(); $this->mail->SMTPSecure = false; $this->mail->Host = 'xxxx.xxxx.xxxx.xxxx'; $this->mail->Port = 25; $this->mail->Username = 'root@mydomain.com'; $this->mail->Password = ''; $this->mail->SetFrom('user', 'My Page'); > 
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) 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_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:$/smtpd_scache smtp_tls_session_cache_database = btree:$/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = mydomain.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = mydomain.com, localhost, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all 

When I try to send an email from my application I get the following error

SMTP -> FROM SERVER:220 mydomain.com ESMTP Postfix (Ubuntu) CLIENT -> SMTP: EHLO www.mydomain.com SMTP -> FROM SERVER: 250-mydomain.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN CLIENT -> SMTP: MAIL FROM: SMTP -> FROM SERVER:250 2.1.0 Ok CLIENT -> SMTP: RCPT TO: SMTP -> FROM SERVER:454 4.7.1 : Relay access denied SMTP -> ERROR: RCPT not accepted from server: 454 4.7.1 : Relay access denied SMTP Error: The following recipients failed: account@hotmail.com Error 

The truth is that is my first time configuring and email server and I have no idea what to do now.

Читайте также:  Styled components inline css

I tested postfix from command line and works.

I had a similar problem recently.. [https://serverfault.com/questions/646409/how-do-i-configure-postfix-to-allow-phpmailer-to-send-out-email-through-it][1]

I could fix by adding the following in postfix master.conf..

smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination 

More about smtpd_recipient_restrictions, please chick this Linux postfix/dovecot 554 Relay access denied

Can’t send email in PHP using Postfix, PHP uses an MTA to send it’s mails trough mail (), if you want to override it on system level you could edit /etc/postfix/main.cf and add. relayhost = [smtp.domain.tld]:587. if you are on an older system, you might need to configure sendmail instead. Reply.

Источник

Php postfix php ini

Posted under » PHP » Ubuntu on 20 April 2017

Sending mail from your server can be done via an internal SMTP or an external one.

For the latter, you can use PHPMailer.

But sometimes, our own server on localhost is preferred.

Do do this, you need to have either Sendmail or Postfix.

You cannot have both MTA at the same time so I am more interested in the one that I use. ie. Postfix

All you need to do is config this on your php config file or PHP.ini.

sendmail_path = "/usr/sbin/sendmail -t -i" // in case you want to see the logs from the php point of view mail.log = /var/log/phpmail.log

For backward compatibility purposes, usually /usr/sbin/sendmail is used. Sendmail was around first 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. So it doesn’t matter if you use Postfix or Sendmail.. it will still work.

If it doesn’t work, you can try this.

sendmail_path = /etc/postfix

FYI, The first option worked for me.

Send an email test to see if it works.

ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "tonykfc@lkybast.com"; $to = "limpeh@lkybast.com"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; mail($to,$subject,$message, $headers); echo "Test email sent";

Источник

Оцените статью