syslog is consistently returning for a specific domain the following result:
relay=mail.domain.tld. [XX.XXX.XXX.XX], dsn=5.0.0, stat=Service unavailable
what is a possible cause of the service unavailability and how can this be resolved?
sendmail (by sendmail.org) - getting outgoing SMTP transcript
As root send a test message with SMTP session tracking. It may provide more hints.
#!/bin/sh
TO=recipient#domain.tld
FROM=someone#your.domain
/usr/sbin/sendmail -v -Ac -i -f$FROM -- $TO <<END
subject: test
to: $TO
from: $FROM
test
END
Related
I am trying to set up a postfix mail server with dovecot as MDA.
According to this link to set up dovecot to use LMTP I have done the following config.
postfix
main.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
master.cf
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -d ${user}
dovecot
dovecot.conf
protocols = imap lmtp
10-mail.conf
mail_privileged_group = mail
10-master.conf
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
# Create inet listener only if you can't use the above UNIX socket
#inet_listener lmtp {
# Avoid making LMTP visible for the entire internet
#address =
#port =
#}
}
The mailboxes will be present in user's home directory /users/<username>
As stated by the link /users is the home directory of vmail user.
However with this config when I try to send mail like:
mail -s "subj" username
The mail bounces saying
warning: maildir access problem for UID/GID=<uid>/<gid>: create maildir file ~username/Maildir/tmp/<tmp file>: Permission denied
The ownership of ~username is vmail:vmail
However the mail is successfully sent when the ownership is changed to <user>:<group> for each user.
How can I get this thing working with the mail directory ownership kept as vmail:vmail ?
Note: I am not trying to set up SASL as of yet.
I am just tryin
You need to change ownership users and groups using below mentioned command.
example:-
chown -R user:group /path/to/file
-R --> recursive option
We have a part of a mail filter that denies emailing system accounts for security purposes. We recently had a user created that ends in "bin". The bin user is restricted, but the user, lets say l.parrbin, gets flagged via the syntax below:
my #sysaccounts = qw(
root bin daemon adm lp sync shutdown halt mail
news uucp operator games gopher ftp nobody nscd
vcsa rpc mailnull smmsp apache pcap ntp dbus
avahi rpcusder nfsnobody sshd haldaemon xfs defang
clamav monit mysql decode webmaster mailer-daemon
nagios
);
foreach $acct(#sysaccounts){
if ($recip =~ /$acct\#/i){
md_syslog('info', 'Sysaccount Discard');
return('REJECT', "We do not accept messages to system accounts ($acct)");
}
}
How would I prevent the above code from returning REJECT if a name ends or starts with a name from the sysaccounts?
Try doing this :
if ($recip =~ /^$acct\#/i){
# ^
In regex, ^ is an anchor meaning beginning of line (string here)
I have a postfix mail server which sends email from both virtual addresses and from local Unix accounts, through a PHP script using mail().
I've installed Amavis and have successfully configured filtering and and the addition of mail signatures for the virtual addresses, but the signatures are not added for any mail sent by the local accounts (e.g. through a script or the mail command)
I've tried a heap of config and routing changes but no luck- does anyone please know how to filter such local outgoing mail?
Thanks!
For future reference, the answer was a postfix configuration setting:
non_smtpd_milters =
The postfix content filtering setting (content_filter) does not seem to apply to non-smtpd traffic, such as that sent by Unix accounts or PHP mail() script.
Actually this is wrong. From Stef on the mailing list changing the message body is not implemented via milter interface:
Have a look at the following documentation:
- http://www.amavis.org/README.postfix.html
- http://www.postfix.org/FILTER_README.html [Advanced content filter example]
A quick run through the config files [this is a quick cut-and-paste from my config files; beware that the port numbers might not match the above documents]:
/etc/amavisd.conf
$notify_method = 'smtp:[127.0.0.1]:10025';
$forward_method = 'smtp:[127.0.0.1]:10025';
$inet_socket_port = [10024, 10026];
$interface_policy{'10026'} = 'ORIGINATING';
$policy_bank{'ORIGINATING'} = { # mail supposedly originating from our users
originating => 1, # declare that mail was submitted by our smtp client
allow_disclaimers => 1, # enables disclaimer insertion if available
}
/etc/postfix/master.cf
smtp inet n - n - - smtpd
-o content_filter = smtp-amavis:[127.0.0.1]:10024
[ you can also have the above config_filter configuration in /etc/postfix/main.cf as a default setting.
The options below override the defaults in main.cf ]
smtp-amavis unix - - n - 4 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
-o smtp_generic_maps=
localhost:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_delay_reject=no
-o smtpd_authorized_xforward_hosts=127.0.0.0/8,[::1]/128
-o smtpd_authorized_xclient_hosts=127.0.0.0/8,[::1]/128
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o smtpd_restriction_classes=
-o mynetworks=127.0.0.0/8,[::1]/128
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o local_header_rewrite_clients=
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o content_filter=smtp-amavis:[127.0.0.1]:10026
pickup unix n - n 60 1 pickup
-o content_filter=smtp-amavis:[127.0.0.1]:10026
Quick comments:
- incoming e-mail enters on port 25; with the “content-filter” option, it is sent to a mavis on port 10024
- amavis scans, tags, quarantines, … — if mail goes through, it goes to (postfix) port 10025 (this is done with the “$forward_method” in amavisd.conf)
- postfix (listening on port 10025) delivers the e-mail
outgoing e-mail should enter on the submission port [587] or delivered with the pickup service (“local e-mail”).
postfix forwards this e-mail to amavis on port 10026 (!)
the configuration of amavis is changed because of a “policy bank”
again, amavis forwards e-mail to postfix on port 10025
postfix (listening on port 10025) delivers e-mail
Kind regards,
Stef
I had a similar problem (in my case I use amavis to add the dkim signature) and it turns out that the problem was that, in master.cf, the pickup service was defined with "-o content_filter=", that's why content_filter wasn't working for locally generated emails, i.e.
pickup fifo n - n 60 1 pickup
-o content_filter=
-o receive_override_options=
Once I commented out the "-o content_filter=" amavis started filtering even the locally generated messages.
I'm adding a solution since I cannot add a comment and this is the first result when I searched for "postfix content_filter doesn't work for locally generated mail".
I want to send an email from my vbscript code, the below code is working properly on my machine, but when I changed my machine, the code is no more able to send email.
There were no errors or problems occurred during run, but no emails were sent/delivered.
Has anyone else faced a problem like this?
Set objMessage = CreateObject("CDO.Message")
With objMessage
.From = SendFrom
.To = SendTo
.Subject = "Subject"
.Textbody = ""
.HTMLBody = "<b>Body</b>"
With .Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP.Gmail.Com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Username"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
.Update
End With
.Send
End With
First, since you didn't post the entire code, check that your script doesn't contain a line
On Error Resume Next
If it does: remove the line and try again.
If you don't have that line in your script and the script doesn't raise an error and you can telnet mailserver 25 then it's almost certain that the mail server accepted the mail for delivery and the problem is somewhere upstream. Check the mail server logs.
You can verify if the server actually accepts mail like this:
C:\>telnet mailserver 25
220 mailserver ESMTP
HELO clientname
250 mailserver
MAIL FROM:<joe.average#example.com>
250 2.1.0 Ok
RCPT TO:<joe.average#example.com>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: test
test
.
250 2.0.0 Ok: queued as 4541E2227
QUIT
The line before the QUIT command means that the server accepted the mail. The actual response text may vary depending on which MTA is used, but every MTA will respond with some line like that when it accepts a message.
I would imagine this is a permissions issue or a firewall issue if it is working on your machine but not the production machine.
Carefully look at what is different, is one behind the firewall and other is not?
You need to install CDonts library first. Search on microsoft.com for CDONTS library and install the same.
If you want to send without installation then try the second method. you have to initialize the objects.
In that example i remove h in the link because i can't post links
CDO.MESSAGE
'Script to send an email through QTP nice one
Set oMessage = CreateObject("CDO.Message")
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
oMessage.Configuration.Fields.Item _
("ttp://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
oMessage.Configuration.Fields.Item _
("ttp://schemas.microsoft.com/cdo/configuration/smtpserver") =""
'Server port (typically 25)
oMessage.Configuration.Fields.Item _
("ttp://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMessage.Configuration.Fields.Update
oMessage.Subject = "Test Mail"
oMessage.Sender = ""
oMessage.To =""
'oMessage.CC = ""
'oMessage.BCC = ""
oMessage.TextBody = "Test Mail from QTP"&vbcrlf&"Regards,"&vbcrlf&"Test"
oMessage.Send
Set oMessage = Nothing
I've just upgraded from XAMPP 1.7.3 to 1.8.0, this included quite a few changes (PHP 5.4 etc) as I went through the reinstallation of my dev-environment.
Anyways, everything works now, except for Sendmail.
Before, you had a configuration in sendmail.ini like this:
#defaults
logfile "C:\XAMPP\sendmail\sendmail.log"
## A freemail service example
account Hotmail
tls on
tls_certcheck off
host smtp.live.com
from [exampleuser]#testmail.loc
auth on
user [exampleuser]#hotmail.com
password [examplepassword]
# Set a default account
account default : Hotmail
Plus some values in php.ini:
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
SMTP = localhost
smtp_port = 25
Now it all looks a lot different (and the old config wouldn't work), an example:
http://pastebin.com/M83bNmJw
A little php mail script:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$to = "someone#hotmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
Message delivery failed...
I guess I'm too stupid to change the correct things, it just won't work, plus I barely get an error in my log-files, so I don't even know where to start.
#GMAIL mit XAMPP 1.8.1 und sendmail
[CODE]
[sendmail]
; HOTMAIL
smtp_server=smtp.gmail.com
smtp_port=25
smtp_ssl=tls
tls_certcheck off
error_logfile=error.log
debug_logfile=debug.log
auth_username= xxxx.xxxx#gmail.com
auth_password=xxxxxxx
this settings in php.ini
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = smtp.gmail.com
; smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = xxxx.xxxx#gmail.com
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.
; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "\"C:\sendmail\sendmail.exe\" -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
;sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"
; 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(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log = "C:\xampp\php\logs\php_mail.log"
I see that in 1.8.0, the default will send mail through mailtodisk.exe. You have enabled it in your PHP config file, but have you disabled mailtodisk.exe?
In addition, you'll need to ensure that smtp_server in sendmail.ini is set to localhost.
I just found this solution myself, and all mail sent using PHP works.
My xampp is 1.8.2 with window 8.1
In php.ini
smtp_port = 587
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
mail.add_x_header=Off
In sendmail.ini
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
auth_username=xxaayy#gmail.com
auth_password=kskcmhlrjr
pop3_server=
pop3_username=
pop3_password=
force_sender=xxaayy#gmail.com
force_recipient=
hostname=
To account gmail "auth_password" you need create new password "Your application-specific passwords", check [here][1]
then follow these steps:
The problem is that sendmail has to be run as an administrator. This is the solution to help any one on my situation.
Right click on sendmail.exe
Properties
Compatibility
Change the configuration for all users
Execute as Windows XP SP 3
Execute as adminitrator
test email
$to = "aaaaaaa#domain.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$headers = "From: xxaayy#gmail.com" . "\r\n";
if (mail($to, $subject, $body, $headers)) {
echo ("Message successfully sent!");
} else {
echo ("Message delivery failed...");
}
I've found a working example, it works like a charm now
http://blog.joergboesche.de/xampp-sendmail-php-mailversand-fuer-windows-konfigurieren#xampp_180_sendmail