我正在用 vb.net 开发一个程序,它需要直接连接到我的邮件服务器 (postfix) 来发送电子邮件,这些电子邮件将直接发送到电子邮件到短信传输。我的邮件服务器运行正常,我没有遇到任何功能问题(它在 squirrelmail 上发送和接收都没有问题)。我还尝试使用http://www.nanogenesis.fr/并且报告了相同的错误,我认为这是我的 postfix 设置的问题。我的应用程序目前正在运行代码(并且还可以轻松运行身份验证):
'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("[email protected]")
mail.[To].Add("[email protected]")
'set the content
mail.Subject = "Page"
mail.Body = "this email is to test the paging system"
'set the server
Dim smtp As New SmtpClient("fasttrackdispatch.com")
Dim errmsg As String
'send the message
Try
smtp.Send(mail)
Console.Write("Your Email has been sent sucessfully - Thank You")
Catch exc As Exception
errmsg = "Send failure: " & exc.ToString()
End Try
在我的软件方面这似乎可以正常工作,但是电子邮件没有发送,
mail.log 文件指出
Jan 22 18:53:54 localhost postfix/smtpd[14954]: connect from unknown[199.1.16.46]
Jan 22 18:53:54 localhost postfix/smtpd[14954]: NOQUEUE: reject: RCPT from unknown[199.1.16.46]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<FCRA>
Jan 22 18:53:55 localhost postfix/smtpd[14954]: lost connection after RCPT from unknown[199.1.16.46]
Jan 22 18:53:55 localhost postfix/smtpd[14954]: disconnect from unknown[199.1.16.46]
etc/postfix/main.cf 是
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 = /usr/share/doc/postfix
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = fasttrackdispatch.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = fasttrackdispatch.com, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
任何帮助表示感谢
答案1
我认为发生的事情是 postfix 不知道它应该允许您的 IP 地址 (199.1.16.46) 进行中继。这可能不是最好的解决方案,但您可以将 etc/postfix/main.cf 中的 mynetworks 指令更改为类似以下内容:
mynetworks = 127.0.0.0/8, 199.1.16.46/32
然后重新启动 postfix 并查看是否能使其运行得更好。