質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Raspbian

Raspbianは、DebianベースのRaspberry Pi用ディストリビューション。ハードウェア浮動小数点演算を有効にすることが可能で、Webブラウズなどの速度を向上できます。

SMTP

SMTP(Simple Mail Transfer Protocol)はIPネットワークでemailを伝送する為のプロトコルです。

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

メール

メールは、コンピュータネットワークを利用し、 情報等を交換する手段のことです。

Q&A

解決済

1回答

2207閲覧

Postfix : gmail を経由せずにメールを送信

Probmkr

総合スコア14

Raspbian

Raspbianは、DebianベースのRaspberry Pi用ディストリビューション。ハードウェア浮動小数点演算を有効にすることが可能で、Webブラウズなどの速度を向上できます。

SMTP

SMTP(Simple Mail Transfer Protocol)はIPネットワークでemailを伝送する為のプロトコルです。

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

メール

メールは、コンピュータネットワークを利用し、 情報等を交換する手段のことです。

0グッド

0クリップ

投稿2021/07/27 12:08

実現したいこと

今 raspberry pi でメールサーバーを構築しているんですけれど、外部にメールを送ること自体はできました。
ですが、smtp.gmail.com 経由ですので、自分のgmailアカウント example@gmail.com での送信になってしまいます。
どうしたら経由せずに自分のサーバーから送れるようになるのでしょうか。

環境

・Raspbian
・Postfix
・Dovecot

postfixの設定ファイル

今の設定ファイルの状況です。この状況だと、送信はできますが、gmail アカウントとして送信されてしまいます。

main.cf

main.cf

1compatibility_level = 2 2command_directory = /usr/sbin 3daemon_directory = /usr/lib/postfix/sbin 4data_directory = /var/lib/postfix 5mail_owner = postfix 6myhostname = mail.probmkr.com 7mydomain = probmkr.com 8myorigin = $mydomain 9inet_interfaces = all 10unknown_local_recipient_reject_code = 550 11mynetworks_style = subnet 12mynetworks = 127.0.0.0/8 13relayhost = [smtp.gmail.com]:587 14home_mailbox = Maildir/ 15smtpd_banner = $myhostname ESMTP unknown 16debugger_command = 17 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin 18 ddd $daemon_directory/$process_name $process_id & sleep 5 19sendmail_path = /usr/sbin/postfixr/sbin/newaliases 20 21mailq_path = /usr/bin/mailq 22 23setgid_group = postdrop 24inet_protocols = ipv4 25 26############ 27############ 28smtp_sasl_auth_enable = yes 29smtp_tls_security_level = may 30smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 31smtp_sasl_mechanism_filter = login plain 32smtp_sasl_security_options=noanonymous 33 34 35 36smtpd_sasl_auth_enable = yes 37smtpd_sasl_type = dovecot 38smtpd_sasl_path = private/auth 39smtpd_use_tls = yes 40smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination 41 42 43smtpd_tls_cert_file = /etc/letsencrypt/live/mail.probmkr.com/fullchain.pem 44smtpd_tls_key_file = /etc/letsencrypt/live/mail.probmkr.com/privkey.pem 45smtpd_tls_loglevel = 1 46smtpd_tls_received_header = yes 47 48 49 50 51smtpd_sasl_local_domain = $myhostname 52smtpd_recipient_restrictions = 53 permit_mynetworks 54 permit_sasl_authenticated 55 reject_unauth_destination

master.cf

master.cf

1# 2# Postfix master process configuration file. For details on the format 3# of the file, see the master(5) manual page (command: "man 5 master" or 4# on-line: http://www.postfix.org/master.5.html). 5# 6# Do not forget to execute "postfix reload" after editing this file. 7# 8# ========================================================================== 9# service type private unpriv chroot wakeup maxproc command + args 10# (yes) (yes) (no) (never) (100) 11# ========================================================================== 12smtp inet n - y - - smtpd 13#smtp inet n - y - 1 postscreen 14#smtpd pass - - y - - smtpd 15#dnsblog unix - - y - 0 dnsblog 16#tlsproxy unix - - y - 0 tlsproxy 17submission inet n - y - - smtpd 18# -o syslog_name=postfix/submission 19# -o smtpd_tls_security_level=encrypt 20 -o smtpd_sasl_auth_enable=yes 21# -o smtpd_tls_auth_only=yes 22# -o smtpd_reject_unlisted_recipient=no 23# -o smtpd_client_restrictions=$mua_client_restrictions 24# -o smtpd_helo_restrictions=$mua_helo_restrictions 25# -o smtpd_sender_restrictions=$mua_sender_restrictions 26# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject 27 -o smtpd_relay_restrictions=permit_sasl_authenticated,reject 28# -o milter_macro_daemon_name=ORIGINATING 29smtps inet n - y - - smtpd 30# -o syslog_name=postfix/smtps 31 -o smtpd_tls_wrappermode=yes 32 -o smtpd_sasl_auth_enable=yes 33# -o smtpd_reject_unlisted_recipient=no 34# -o smtpd_client_restrictions=$mua_client_restrictions 35# -o smtpd_helo_restrictions=$mua_helo_restrictions 36# -o smtpd_sender_restrictions=$mua_sender_restrictions 37# -o smtpd_recipient_restrictions= 38 -o smtpd_relay_restrictions=permit_sasl_authenticated,reject 39# -o milter_macro_daemon_name=ORIGINATING 40#628 inet n - y - - qmqpd 41pickup unix n - y 60 1 pickup 42cleanup unix n - y - 0 cleanup 43qmgr unix n - n 300 1 qmgr 44#qmgr unix n - n 300 1 oqmgr 45tlsmgr unix - - y 1000? 1 tlsmgr 46rewrite unix - - y - - trivial-rewrite 47bounce unix - - y - 0 bounce 48defer unix - - y - 0 bounce 49trace unix - - y - 0 bounce 50verify unix - - y - 1 verify 51flush unix n - y 1000? 0 flush 52proxymap unix - - n - - proxymap 53proxywrite unix - - n - 1 proxymap 54smtp unix - - y - - smtp 55relay unix - - y - - smtp 56 -o syslog_name=postfix/$service_name 57# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 58showq unix n - y - - showq 59error unix - - y - - error 60retry unix - - y - - error 61discard unix - - y - - discard 62local unix - n n - - local 63virtual unix - n n - - virtual 64lmtp unix - - y - - lmtp 65anvil unix - - y - 1 anvil 66scache unix - - y - 1 scache 67postlog unix-dgram n - n - 1 postlogd 68# 69# ==================================================================== 70# Interfaces to non-Postfix software. Be sure to examine the manual 71# pages of the non-Postfix software to find out what options it wants. 72# 73# Many of the following services use the Postfix pipe(8) delivery 74# agent. See the pipe(8) man page for information about ${recipient} 75# and other message envelope options. 76# ==================================================================== 77# 78# maildrop. See the Postfix MAILDROP_README file for details. 79# Also specify in main.cf: maildrop_destination_recipient_limit=1 80# 81maildrop unix - n n - - pipe 82 flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} 83# 84# ==================================================================== 85# 86# Recent Cyrus versions can use the existing "lmtp" master.cf entry. 87# 88# Specify in cyrus.conf: 89# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4 90# 91# Specify in main.cf one or more of the following: 92# mailbox_transport = lmtp:inet:localhost 93# virtual_transport = lmtp:inet:localhost 94# 95# ==================================================================== 96# 97# Cyrus 2.1.5 (Amos Gouaux) 98# Also specify in main.cf: cyrus_destination_recipient_limit=1 99# 100#cyrus unix - n n - - pipe 101# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} 102# 103# ==================================================================== 104# Old example of delivery via Cyrus. 105# 106#old-cyrus unix - n n - - pipe 107# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} 108# 109# ==================================================================== 110# 111# See the Postfix UUCP_README file for configuration details. 112# 113uucp unix - n n - - pipe 114 flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) 115# 116# Other external delivery methods. 117# 118ifmail unix - n n - - pipe 119 flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) 120bsmtp unix - n n - - pipe 121 flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient 122scalemail-backend unix - n n - 2 pipe 123 flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} 124mailman unix - n n - - pipe 125 flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py 126 ${nexthop} ${user}

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

CHERRY

2021/07/27 13:02 編集

多くのプロバイダの回線では、迷惑メール送信防止の為、直接のメール送信に規制をかけています。(OP25B等) ご利用のインターネット回線は、何でしょうか? そのような制限はありませんか?
Probmkr

2021/07/27 13:17

ソフトバンク光です。
guest

回答1

0

ベストアンサー

クラウドサービスなどに

  1. VPNサーバを立ててラズパイでVPN接続し、クラウドサービスの回線経由で送信する
  2. メールリレーサーバ(25port以外)を用意し、ラズパイからメールリレーサーバ経由でメールを送信する

が、現実的ですかねー

OP25Bについて調べて理解すれば、自宅サーバから直接送信するのは現実的ではないということがわかると思います。

投稿2021/07/28 02:04

scsi

総合スコア2840

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問