mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Guess first/lastname
This commit is contained in:
parent
526f208131
commit
984ef5f4c6
1 changed files with 15 additions and 0 deletions
|
@ -57,13 +57,28 @@ public class EntityAnswer implements Serializable {
|
|||
|
||||
String name = null;
|
||||
String email = null;
|
||||
String first = null;
|
||||
String last = null;
|
||||
if (from != null && from.length > 0) {
|
||||
name = ((InternetAddress) from[0]).getPersonal();
|
||||
email = ((InternetAddress) from[0]).getAddress();
|
||||
}
|
||||
if (name != null) {
|
||||
name = name.trim();
|
||||
int c = name.lastIndexOf(",");
|
||||
if (c < 0) {
|
||||
first = name;
|
||||
last = name;
|
||||
} else {
|
||||
first = name.substring(c + 1).trim();
|
||||
last = name.substring(0, c).trim();
|
||||
}
|
||||
}
|
||||
|
||||
String text = answer.text;
|
||||
text = text.replace("$name$", name == null ? "" : name);
|
||||
text = text.replace("$firstname$", first == null ? "" : first);
|
||||
text = text.replace("$lastname$", last == null ? "" : last);
|
||||
text = text.replace("$email$", email == null ? "" : email);
|
||||
|
||||
return text;
|
||||
|
|
Loading…
Reference in a new issue