Configure postfix to view catch-all address in mail header - linux

I configured catchall for postfix as follows:-
"#vim /etc/postfix/virtual
#example.com test"
So if we send mail to xyzjsdv#example.com will get delivered to test#example.com.
But the problem was it always shows the same user name in the mail header "test#example.com". I created a script for checking the mail header, so that I need the particular user#example should be display at the mail header since I need to differentiate all the users.
Please help me how to configure the postfix, so that I will get this outcome. Sudden answers would be appreciated

Not an answer - but some questions as I have no rep I can't put comments on.
What version of postfix are you running?
I'm doing a similar thing on 2.8, and it is working as expected, ie: the message itself (not the "envelope") has the correct headers - ie: the message is unmodified.
What test message are you sending? I would suggest testing with something simple, using telnet run the following, eg:
telnet <server> 25
Connected to <server>.
Escape character is '^]'.
220 mail.example.com ESMTP
helo test.com
250 nbb-dev.safenetbox.biz
mail from:<somewhere#example.com>
250 2.1.0 Ok
rcpt to: <def#example.com>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Sender: abc#example.com
Subject: testing
body
.
quit
For me this gives the "letter" message with the sender as "abc#example.com".
Also ensure there are no *header_rewrite* settings, except defaults (I have never used these, but could be related).
How are you getting the message, from a mailbox, or is it getting sent to a program directly? If going to a mailbox, is it getting forwarded?

Related

Email received but sender get "Undelivered Mail Returned to Sender" after 5 days

I manage a server with Plesk 12.5 since a couple of years.
Everything (emails, websites, etc.) works perfectly with our main domain (let's call it myfirstdomain.com).
Since a couple of weeks, I added a new domain (let's cal it myseconddomain.fr) and everything seems to work too (emails and websites), except the following error: when a sender sends an email to us, he receives the following error after 5 days:
This is the mail system at host myfirstdomain.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<fabrice#myseconddomain.fr>: Message can not be delivered at this time
Reporting-MTA: dns; myfirstdomain.com
X-Postfix-Queue-ID: DC0B1702585
X-Postfix-Sender: rfc822; xxx#xxx.net
Arrival-Date: Tue, 5 Mar 2019 21:18:00 +0100 (CET)
Final-Recipient: rfc822; fabrice#myseconddomain.fr
Original-Recipient: rfc822;fabrice#myseconddomain.fr
Action: failed
Status: 4.2.1
Diagnostic-Code: x-unix; Message can not be delivered at this time
De: XXX XXX <xxx#uxxxvi.net>
Objet: Testing title
Date: 5 mars 2019 à 21:17:58 UTC+1
À: Fabrice Troilo <fabrice#myseconddomain.fr>
Testing body
You can see that the reporting-MTA is myfirstdomain.com, so maybe there is confusion between the two domains?
Here is our SPF:
"v=spf1 a mx include:_spf.google.com ip4:XX.XX.XX.XX ~all"
I will try with this update for the two domains:
"v=spf1 +a +mx +a:myfirstdomain.com +a:myseconddomain.fr include:_spf.google.com ip4:62.210.16.40 ~all "
Also, the email address is simply forwarding to a gmail address.
Do you please have any clue to look at?
If you can send mail from the domain, but not receive it, it's not related to SPF. SPF authenticates when you send mail, not receive it.
Have you ensured that an MX record is set up for the secondary domain?
You can test this using the terminal on Linux or macOS with host -t MX myseconddomain.fr
If you are on Windows, then open a command prompt, type nslookup. Then when in nslookup, switch to query MX types with set q=mx and press enter. Then enter your domain myseconddomain.frand press enter.
If the MX records looks correct, then it must be some configuration in Plesk. We can test this by trying to deliver mail ourselves with telnet.
Open a terminal/command prompt and type telnet <myserverIP> 25 and press enter. This connects to your mailserver. It should respond with a line beginning with 220, and it's hostname. Then you can try and deliver a simple test mail, let's say from account1#example.net
EHLO example.NET
MAIL FROM:<account1#example.net>
RCPT TO:<fabrice#myseconddomain.fr>
DATA
This is a test email. To test delivery.
.
QUIT
The first few lines introduces yourself, sender and receiver to the mail server. DATA indicates you want to start the body of your email. And the period on a line by itself indicates that you are done with the body. QUIT then terminates the connection.
Then watch what your server says in reply to each command. If you can successfully deliver this way, then it's like a problem with your MX record.
I don't know if you have solve this Problem. If you have please let me know. We have a similar error.
I found out that is has to do with the E-Mail-Header because it may have two domains in it because it gets forwarded. Google don't like this :)
Google has opened a thread about it and they say you can enter the Domain that forward to the gmail address so it is not detected as some kind of spam.
I can not test it because I it is an gmail account from an client and I have no access.
May my executions help. I hope you have an better answer.
Greets Matt

Limesurvey notification emails will not send

I've recently noticed an issue with my Limesurvey installation. Until recently, I had a number of surveys set to email the user after submission (using {email} in the "Send detailed admin notification email" box to refer to an email question in the survey). However despite not manually changing anything, they no longer send. Some others do send from within limesurvey, for example from the "Create new admin" option, while token related emails will not.
In the case of token invitations, the debugging there will say emails sent when using php, but the test emails never arrive (multiple emails tested). When using SMTP, I get the below:
SMTP connect() failed... Some emails were not sent because the server did not accept the email(s) or some other error occured.
I should note that while I first noticed this in existing surveys in version 2.73.0, I've since done a fresh install of 3.1 and created a test survey. So this is pointing at a server config issue, but I haven't had any issues with emails sending except in this specific case.
Any suggestions of particular places to look would be much appreciated!
Did you try to change the email method in settings (https://manual.limesurvey.org/Global_settings/en#Email_settings)?
Email method: This determines how emails are being sent. The following options are available:
PHP (default value): uses internal PHP mail function
Sendmail : uses sendmail mailer
SMTP : based on SMTP relaying. Use this setting when you are running LimeSurvey on a host that is not your mail server
Make sure that you are using your SMTP configured email (Global settings -> Email settings) if you use SMTP, otherwise there might be a chance that the following error is displayed: 'SMTP -> ERROR: RCPT not accepted from server: 553 5.7.1 : Sender address rejected: not owned by user'
Qmail : Set this if you are running the Qmail mailer

Unable to send email to office 365 via linux command

I am trying to send email via linux command line using following command
echo "This is body part" | mail -s "this is subject" username#domain.com
If I send to gmail it works but if i send to office365 it does not work.
Could you help me?
This can also quite often be because of the mail relay server you are using (where the SMTP mail is routing through from the Linux box) not having been set up properly with public RDNS records. Many mail servers reject mail that comes from a domain without the appropriate RDNS configuration.
User checklist for "non delivered messages"
Checked Junk/Spam folder in the receiving mailbox.
Check sender mailbox for bounce (delivery problem report) mail messages.
You may receive first "warning email" after a few hours (e.g. 4h) of failing delivery attempts.
Some botched anti-spam system throw away messages "classified as spam" without any hint to the sender or the recipient -> ask admin/postmaster of the receiving mail server

Add unix user to postfix maillogs

I am using CentOS 6, and postfix mail server, from postfix mail log, I want to see which Linux user has sent specific email, is it possible? How can this be done?
I need this to prevent spam from our mailservers, by one of our users. I need to figure out which user, and what script.
Since you know which email you are looking for (you should know its ID from the message header), you can simply find it in postfix mail log located in /var/log/mail.log - just look for the message ID in the log.

Postfix forwarding to googlemail

I have a Problem with my virtual Server and the Combination of forwarding mails to googlemail.
I thry to forward mails to my googlemail-account, in the mail.log seems everything ok, but the mails never arrived.
Line in the mail.log:
postfix/smtp[3496]: F354E10E145: to=<xxxxx#gmail.com>, orig_to=<xxxxx#plockbrothers.de>, relay=gmail-smtp-in.l.google.com[74.125.136.26]:25, delay=0.96, delays=0.3/0/0.07/0.59, dsn=2.0.0, status=sent (250 2.0.0 OK 1420233196 ev12si92450098wjc.67 - gsmtp)
When I´m forwarding the mails for example to an web.de account, everything works fine. The mails arrived.
Anybody an Idea?
Had the same thing happen, thing is: they do arrive - but they do not appear in the Inbox or anywhere. However they still can be found in "All Mail"!
I found the Solution. The Mails arrived, but they dosn't appear in the inbox.
When you forwarded mails to the same address from where you sended it, the mail will not been shown by googlemail cause its the same mail like the mail in the outbox.

Resources