Set correct sender address for postmaster mails

Infos:

  • Used Zammad version: 5.4.0-1679657495.4658f661.bullseye
  • Used Zammad installation type: package
  • Operating system: Debian Bullseys
  • Browser + version: Firefox 111.0.1

Expected behavior:

  • Use a specific mail address as “from” when sending postmaster mails like the “mail too big” information

Actual behavior:

  • A (random?) address is picked from the list of secondary mail addresses.

Steps to reproduce the behavior:

  1. Setup 5 secondary mail addresses
  2. Send a too-big mail to zammad
  3. Watch the replys “from” address
  4. Edit one of the 5 addresses
  5. repeat 2) and 3): the “from” address is possibly a totally different one

Is the ‘mail too big’ coming from Zammad or your email server? These usually come from the mail server, so I don’t think you can make these changes in Zammad. Unless I misunderstand.

I don’t see how it would randomly pick an email, so it may pick an email based on what group it’s sent to. If it’s Zammad.

It’s from Zammad - not from any mailserver. It’s the mail which cat be toggled on/off in the mail settings, where you can define the max size.

My setup is like this:

  1. Only one input channel: E-Mail
  2. Primary mail is helpesk@mydomain.de
  3. helpesk@mydomain.de” is assigned to group “Support-Master”
  4. “Support-Master” is the target for new Mails/Tickets.
  5. There are a few other groups with assigned mail addresses:
  1. Filters by recipient are used to assign groups

When the “too big” message is sent out it uses one of theses addresses as sender.
When I edit this used address (e.g. helpdesk-group1@ => helpdesk-group1xxx@) then another(!) address i used.

This feels like “take the first element of an somehow ordered list of addresses as sender”.
This ordering seems to change if an element is edited. Or the order of this list/collection/set whatever is undefined.

In the “too big” message the “X-Envelope-From” and “Return-Path” are correct (helpesk@mydomain.de).
But the From-Header seems to have problems.

The question is: Which mail address is intentionally selected as sender by Zammad?

This seems to be the same problem:

So: From which group is this notifictaion sent? Maybe it’s the group which is undefined - not the mail address?

Problem found - maybe in file email_parser.rb:
reply_mail[:from] = EmailAddress.find_by(channel: channel).email
This returns an arbitrary Mail address.

Doing the same in the console
EmailAddress.find_by(channel:Channel.find(3))
returns the used “from” mail in the ovesized message.

After editing this mail address the above command returns one of the other mail addresses.

Maybe
reply_mail[:from] = Setting.get('notification_sender')
would be better here?

As @MrGeneration wrote in Notification sender is not working the sender should be a groups mail address. But the code does not look like using a group specific address.
What am I missing here?

You’re missing this one:

Thanks, @MrGeneration , good to know - I did not understood the code completely wrong. :wink:

Is this problem subject to change? If so, I’d like to test something like this:

Remove
reply_mail[:from] = EmailAddress.find_by(channel: channel).email
and add
from: parsed_incoming_mail[:to_email],
to the reply.merge() part.

Sorry I’m not qualifying code and can’t encourage you to change code on your instance.
If you do that’s on your own danger - I don’t want to wear any guilt there. :wink:

Notification origin if email is too large -using aliases · Issue #4523 · zammad/zammad · GitHub is going to address the issue yes.
The expected behavior is most likely the way it’s going to happen.