Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-2047

Setting the real senders address in mail header from field

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.4.11
    • Fix Version/s: None
    • Component/s: Mail, Mailbox
    • Labels:
      None

      Description

      Due to setting the SMTP envelopes from, it's now possible to fill the mail header from field with the real senders address, in this case stud4@vcrp.de. This is a snippet of the mail header:

      Return-Path: <lms-admin@vcrp.de>
      ...
      From: stud4@vcrp.de
      Reply-To: stud4@vcrp.de
      To: Stephan Clemenz:;
      

      I have choosen this simple solution because it's guaranteed that (if it exists) the ReplyTo contains the real senders address:

      diff --git a/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java b/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java
      --- a/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java
      +++ b/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java
      @@ -1605,6 +1605,8 @@
       		if(StringHelper.containsNonWhitespace(smtpFrom)) {
       			try {
       				SMTPMessage smtpMsg = new SMTPMessage(msg);
      +				if (msg.getReplyTo()[0] != null)
      +					smtpMsg.setFrom(msg.getReplyTo()[0]);
       				smtpMsg.setEnvelopeFrom(smtpFrom);
       				msg = smtpMsg;
       			} catch (MessagingException e) {
      

        Attachments

          Activity

            People

            Assignee:
            srosse Stéphane Rossé
            Reporter:
            stephan Stephan Clemenz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: