标签: postfix

配置Postfix以在Ubuntu上使用Gmail SMTP

我在这里使用这个在线指南,通过一些gmail帐户启用从linux(ubuntu)终端发送简单邮件和postfix.我已经完成了那里列出的步骤:

sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
vim /etc/postfix/main.cf
Run Code Online (Sandbox Code Playgroud)

并添加以下行:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
Run Code Online (Sandbox Code Playgroud)

然后编辑此文件:

vim /etc/postfix/sasl_passwd
Run Code Online (Sandbox Code Playgroud)

要添加指南中所说的行:

[smtp.gmail.com]:587    USERNAME@gmail.com:PASSWORD
Run Code Online (Sandbox Code Playgroud)

(当然有我自己的邮件和密码)然后最后:

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
Run Code Online (Sandbox Code Playgroud)

然后:

sudo /etc/init.d/postfix reload
Run Code Online (Sandbox Code Playgroud)

当我尝试发送一封简单的邮件时,没有任何反应:

echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com
Run Code Online (Sandbox Code Playgroud)

(当然这里也有一些其他有效的电子邮件)

我究竟做错了什么?谢谢!

gmail smtp postfix

10
推荐指数
1
解决办法
496
查看次数

Postfix - 收件人地址被拒绝:本地收件人表中的用户未知

我正在学习(尝试)在 Centos 7 VM 中构建我自己的邮件服务器。当我收到的邮件被拒绝时,我遇到了一个问题。使用 POSTFIX 我试图将电子邮件从 gmail 发送到我的邮件,但它被这个错误卡住了。下面我将提供尽可能多的信息。顺便说一句,我没有任何 DNS 记录,所以我只使用 IP。用户是约翰。

[root@mail ~]# cat /etc/aliases
john: john
Run Code Online (Sandbox Code Playgroud)

从 (postconf -d; postconf -d; postconf -n; ) 输出 | 排序 | uniq -u

mydomain = marhyno.info
myhostname = mail
mynetworks = all
mydestination = localhost.$mydomain, localhost, mail.marhyno.info, <myipo>
smtpd_recipient_restrictions =
    permit_sasl_authenticated
    permit_mynetworks
    reject_unauth_destination
resolve_numeric_domain = yes
relay_recipient_maps =
alias_maps = hash:/etc/aliases                                                                            
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
biff = no
html_directory = /usr/share/doc/packages/postfix/html
local_recipient_maps = unix:passwd.byname $alias_maps
Run Code Online (Sandbox Code Playgroud)

tail -f /var/log/maillog 的输出 …

email centos postfix

7
推荐指数
1
解决办法
2万
查看次数

Swiftmailer:无法连接TLS加密

我正在尝试使用Swiftmailer通过Symfony发送电子邮件.在生产服务器上,我收到一个错误:

[2016-08-20 11:59:37] app.ERROR: Exception occurred while flushing email queue: Unable to connect with TLS encryption [] []
Run Code Online (Sandbox Code Playgroud)

这是我在config.yml中的内容:

swiftmailer:
transport: smtp
host:      localhost
username:  info@derkvanderheide.nl
password:  testpw
spool:     { type: memory }
encryption: tls
port:       587
Run Code Online (Sandbox Code Playgroud)

Postfix是我的邮件服务器,它与Plesk一起安装.

这是我的postfix main.cf:

# 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 …
Run Code Online (Sandbox Code Playgroud)

php plesk swiftmailer symfony postfix

6
推荐指数
1
解决办法
7393
查看次数

后缀 - 必须首先发出STARTTLS命令

我试图通过postfix通过gmail发送电子邮件,但它显示以下错误:

必须首先发出STARTTLS命令.

Sep  6 01:11:34 NovusTec postfix/smtp[10889]: 1284460D68: to=<cassa@gmail.co>, relay=smtp.gmail.com[64.233.190.108]:587, delay=2882, delays=2881/0.02/0.83/0.19, dsn=5.7.0, status=bounced (host smtp.gmail.com[64.233.190.108] said: 530 5.7.0 Must issue a STARTTLS command first. k65sm16819558qkf.7 - gsmtp (in reply to MAIL FROM command))
Run Code Online (Sandbox Code Playgroud)

/etc/postfix/main.cf中

# 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 …
Run Code Online (Sandbox Code Playgroud)

gmail smtp postfix

5
推荐指数
2
解决办法
1万
查看次数

Gmail smtp SASL 身份验证

我正在使用 postfix 通过 gmail 发送带有应用程序密码的电子邮件(激活了两步验证)。

每次我使用 sendmail 命令测试发送邮件时,我都会收到此错误:

Action: delayed
Status: 4.7.14
Diagnostic-Code: X-Postfix; delivery temporarily suspended: SASL authentication
failed; server smtp.gmail.com said: 534-5.7.14
<https://accounts.google.com/signin/continue?...> Please log in via your web browser and?534-5.7.14 then try again.?534-5.7.14
Run Code Online (Sandbox Code Playgroud)

这是我的后缀配置:

主文件

myorigin = /etc/mailname
mydestination = mydomain.com, localhost.fr, localhost
relayhost = [smtp.gmail.com]:587

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
Run Code Online (Sandbox Code Playgroud)

/etc/postfix/sasl/sasl_passwd

[smtp.gmail.com]:587 admin@mydomain.com:application_password
Run Code Online (Sandbox Code Playgroud)

这就是我使用 sendmail 的方式:

sendmail -v ...
From: admin@mydomain.com
Subject: Test
This is …
Run Code Online (Sandbox Code Playgroud)

email gmail smtp two-step-verification postfix

4
推荐指数
2
解决办法
1万
查看次数

Dockerizing Postfix 中继服务器

我正在尝试构建一个专用于 Postfix SMTP 中继的 docker 容器。经过多次尝试,我未能让它在其上启动 postfix 服务。

这是 dockerfile

FROM centos:centos7
LABEL Author = "Aurelien HUGON 
LABEL Description = "DOCKERFILE : Creates a Docker Container for a Relay Postfix smtp server"

#Update and soft
RUN yum update -y

RUN yum install -y nano postfix

#Clean install
RUN yum clean all

#Config
COPY /cfg/config.sh /
RUN chmod +x config.sh
RUN ./config.sh
RUN touch /var/log/maillog

CMD ["sh", "-c", "/sbin/postfix start", "tail -f /var/log/maillog"]
Run Code Online (Sandbox Code Playgroud)

config.sh 文件包含:

postconf -e 'myhostname = myserverhostname'
postconf …
Run Code Online (Sandbox Code Playgroud)

docker dockerfile postfix

3
推荐指数
2
解决办法
6780
查看次数

加载密钥时 opendkim 权限被拒绝

我已将 opendkim 安装到我的 Ubuntu 服务器 14.04.4 LTS。我已将 postfix 配置设置为使用 opendkim 之前创建的 mail.private 密钥。

当我尝试发送邮件时,我在 /var/log/mai.log 文件中看到以下消息

Jan 29 09:19:47 test postfix/smtpd[2427]: connect from ip6localhost[127.0.0.1]
Jan 29 09:19:47 test postfix/smtpd[2427]: 625E3E0FE7: client=ip6-localhost[127.0.0.1]
Jan 29 09:19:47 test postfix/cleanup[2431]: 625E3E0FE7: message-id=<890ba29cd6ef289c50581335723ccdb9[edited domain]>
Jan 29 09:19:47 test opendkim[1370]: can't load key from /etc/opendkim/keys/mail.private: Permission denied
Jan 29 09:19:47 test opendkim[1370]: 625E3E0FE7: error loading key 'mail._[edited domain]'
Run Code Online (Sandbox Code Playgroud)

密钥存储在文件夹 /etc/opendkim/keys 中

root@test:/home/crewlog.com# ls -l /etc/opendkim
total 16
drw------- 2 opendkim opendkim 4096 Jan 29 07:49 keys …
Run Code Online (Sandbox Code Playgroud)

dkim ubuntu-14.04 postfix

1
推荐指数
1
解决办法
6407
查看次数

后缀的负数前缀

如何将负数从中缀转换为后缀?

假设我有一个表达式

a =-b-(-cd)

在某些地方,我读到您可以将诸如

a =(-b)-(-cd)

但是在这里,如果我这样做的话,我将在后缀表达式的开头得到类似“ ab-”的术语,表示ab且不正确。

我该如何转换呢?

infix-notation infix-operator postfix

1
推荐指数
1
解决办法
2527
查看次数