Wildcards in an email address with qmail? - qmail

I'm trying to set up an email address in qmail such that a unique identifier can be passed as part of the email address.
For example:
reply-123#example.com, reply-345#example.com, reply-99999#example.com would all go to the 'reply' user and be sent to the same shell script. Currently, email sent to reply#example.com goes to the script and I pass the unique id in the subject or message body. Would be grateful for any suggestions. Thanks!

In a default qmail setup, you can do exactly what you suggest... anything following a dash is ignored for delivery purposes, so reply-anything#example.com will be processed by the .qmail-reply file, where you would presumably send the mail to your script and look at the address to obtain the identifier.
We use this for bounce tracking - if the email is to xyz#example.com, and the sender is bounce#sender.com, then the from address is written this way:
bounce-xyz=example.com#sender.com
And a script flags the address as no good.
EDIT:
I screwed this up a bit - I guess I'm rusty on qmail. The alias thing doesn't work by default as I stated above. To support extensions for bounce#sender.com, you need a .qmail-default file in ~bounce.
See the "extension addresses" (section 4.1.5) on LWQ: http://www.lifewithqmail.org/lwq.html

Related

How to set hostname used in JavaMail or Apache James Message-Id header?

I am having issues with mail bouncing when sending from my own server to my own active yahoo account using JavaMail. The mails are passing SPF, DKIM and DMARC according to google mail that receives the same messages being bounced by yahoo. I can send messages from other accounts to my yahoo account without issue.
The messages send fine from my server to ZMail, GMail, Microsoft mail. Looking at the emails, the only thing that I have noticed is the message header for the Message-Id. My messages have the following header:
Message-ID: <923936395.17.1634776639078#[internally visible hostname]>
I am wondering if this header could be the problem and whether there is a way in JavaMail or in the Apache James to set the hostname or IP address that gets used in this message so that rather than using the "internally visible hostname", I can get the hostname that is externally visible. I have been searching the available documentation for Apache James and JavaMail but have not found any parameters to try in order to resolve this.
According to the Decompiled SRC of sun mail it should be possible by setting some properties for your session.
props.setProperty("mail.from", user);
props.setProperty("mail.host", host);
//props.setProperty("mail.user", user);
The Id will be updated by the save method (saveChanges()) and will trigger an new ID generation (updateHeaders() -> updateMessageID()). (Looked up in the decompiled MimeMessage.class)
Leading to the HostPart called in javax.mail.internet.InternetAddress.
The relevant method is _getLocalAddress.
Here you can see that the values get extracted from the Properties or will fallback to your local machine.
Used Fields:
user.name
mail.from
mail.user
mail.host
The user.name property can also be looked up from the system props.

Temporary block from yahoo

For quite some time we have been getting the following error from yahoo:
mail.log:6452:Apr 22 19:21:06 aegir postfix/smtp[8997]: 87BCF4C93F: host mta7.am0.yahoodns.net[67.195.228.110] said: 421 4.7.0 [IPTS04] Messages from 188.93.125.68 temporarily deferred due to user complaints - 4.16.55.1; see https://help.yahoo.com/kb/postmaster/SLN3434.html (in reply to end of DATA command)
If someone did get the similar, how did you solve this issue?
I've been trying to contact Yahoo but everytime I get automated response and ticket closure as I send it.
What other thing I can offer is DMARC report if its relevant:
https://mxtoolbox.com/DmarcReportAnalyzer.aspx?id=F-9a3a8364-6cba-41f9-b93f-cfc32155a3f6
Test for headers and every check seems to be working alright:
https://www.mail-tester.com/test-m5ytebosm
Google email is showing everything is pass:
gmail email
gmail header
For now I've tried changing OpenDKIM to relaxed/relaxed from relaxed/simple.
Removed p=quarantine and added p=none
Sorted out SPF record for official signing domain just in case, added another IP address where resourcecenter is found.
Will provide additional info if needed.

MailMessage only accepts sender with #domain

I wrote a code in .NET to send emails in my application:
Oxygenne + ASP.Net:
mensagem:=MailMessage.Create(configemail[1],toUsers);
mensagem.Subject:=title;
mensagem.Body:=body;
mensagem.IsBodyHtml:=IsBodyHtml;
This works fine when configemail[1] is something like "myemail#gmail.com". However, I have the need to send emails without using domain, something like "myemail".
I am getting this error:
The specified string is not in the form required for an e-mail address
I believe this happens because the code validates if the variable has #anydomain in the string.
Am I able to override it, and let the user try to send emails without usind "#domain" in their address?
So far as I'm aware, SMTP requires all recipient mailboxes to have a domain part. You may be able to interact with a specific mail system via other protocols that allows you to interact with just local mailboxes but you shouldn't expect SMTP tools to be the means of doing so.
Per RFC 5321:
Only resolvable, fully-qualified domain names (FQDNs) are permitted
when domain names are used in SMTP ... There are two exceptions to the
rule requiring FQDNs
The reserved mailbox name "postmaster" may be used in a RCPT
command without domain qualification
Which in turn leads us to the syntax for the RCPT command:
rcpt = "RCPT TO:" ( "<Postmaster#" Domain ">" / "<Postmaster>" /
Forward-path ) [SP Rcpt-parameters] CRLF
So, the only generally applicable form that is available is the Forward-Path, which via a few hops (and ignoring some legacy options not helpful to you here) leads us to the Mailbox syntax:
Mailbox = Local-part "#" ( Domain / address-literal )
So, either way you have to have the # and then your choices boil down to a domain name or an IP address. Note that this may give us an opening though - you may be able to get what you want by specifying the addresses as myemail#127.0.0.1.

Qmail email address without hostname/domain name

In our production a user sent an email to the following address "xxx" (Literally the email is address xxx). This address is within our companies organization (xxx#company.com.ph), I am being asked how it was sent without "#company.com.ph".
I told them it was probably the configuration of our SMTP server as I am sure the application I made is not appending "#company.com.ph" to mails without (hostName/domainName).
Our SMTP server is Qmail in a Unix box. Can anyone tell me what configurations we could check to explain how this happened?
Unfortunately, I do not have a Qmail or Unixbox so I cant test it myself and I don't have access to our production servers so I could really use some help.
PS. Can anyone also give me the correct term for "#company.com.ph" is it the hostName/domainName?
Checks Done
1) According to the administrator - "defaultdomain" is set to "mail.company"
Yes by default qmail will add defaultdomain to any recipient address missing the domain part.
#company.com.ph is the domain name part of the email address.
defaultdomain file by default is in /var/qmail/control directory as from documentation: http://www.lifewithqmail.org/lwq.html#config-files

Email Address Varification Application in ASP.NET

I am getting 555 syntax error in mailfrom
SendData(tcpSocket, string.Format("MAIL From: {0}\r\n", MailFrom));
if (!CheckResponse(tcpSocket, 220))
{
tcpSocket.Close();
return false;
}
is it the problem in my local system because of localhost?
Please help me. I am using this code from below link.
http://www.codeproject.com/Articles/5189/End-to-end-Email-Address-Verification-for-Applicat
Please don't try to implement your own SMTP client, use the one that comes with .NET: System.Net.Mail.SmtpClient.
Many SMTP servers require TLS, for example, which your code does not account for.
Furthermore, for security reasons most mailservers will not reveal if an email address in an RCPT TO line is valid or not. If a system can positively reveal an address exists then it can be used by spam harvesters. Consequently using a dry-run of an SMTP client should only be used to validate an email address (because of the complicated rules regarding valid email addresses). The verification (a separate concept from validation) must be performed manually by requiring the user to respond to an email sent to that address, there is no other way to be sure.

Resources