Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
37477 amit 1
package com.spice.profitmandi.common.mail;
2
 
3
/**
4
 * The two ways this system can send mail. There is no third.
5
 */
6
public enum MailSenderType {
7
 
8
    /**
9
     * Authenticates as sdtech@smartdukaan.com. Every message sent this way has its
10
     * From rewritten to that identity, because Google Workspace binds an
11
     * authenticated session to one address and refuses any other with
12
     * "535 Authorization failed: Authenticated user is not authorized to send mail".
13
     */
14
    GOOGLE,
15
 
16
    /**
17
     * Google Workspace relay. Does not authenticate at all — it is authorised by
18
     * allowlisted source IP — so it may legitimately send as noreply@.
19
     */
20
    RELAY;
21
 
22
    public static MailSenderType fromStored(String value) {
23
        if (GOOGLE.name().equals(value)) {
24
            return GOOGLE;
25
        }
26
        // Anything else is the relay, including rows written under labels that
27
        // no longer exist.
28
        return RELAY;
29
    }
30
}