protected internal virtual void setCharset(Email email, string charSetStr) { if (charset != null) { email.Charset = charSetStr; } }
public override void execute(ActivityExecution execution) { string toStr = getStringFromField(to, execution); string fromStr = getStringFromField(from, execution); string ccStr = getStringFromField(cc, execution); string bccStr = getStringFromField(bcc, execution); string subjectStr = getStringFromField(subject, execution); string textStr = getStringFromField(text, execution); string htmlStr = getStringFromField(html, execution); string charSetStr = getStringFromField(charset, execution); Email email = createEmail(textStr, htmlStr); addTo(email, toStr); setFrom(email, fromStr); addCc(email, ccStr); addBcc(email, bccStr); setSubject(email, subjectStr); MailServerProperties = email; setCharset(email, charSetStr); try { email.send(); } catch (EmailException e) { throw LOG.sendingEmailException(toStr, e); } leave(execution); }
protected internal virtual void addBcc(Email email, string bcc) { string[] bccs = splitAndTrim(bcc); if (bccs != null) { foreach (string b in bccs) { try { email.addBcc(b); } catch (EmailException e) { throw LOG.addBccException(b, e); } } } }
protected internal virtual void addCc(Email email, string cc) { string[] ccs = splitAndTrim(cc); if (ccs != null) { foreach (string c in ccs) { try { email.addCc(c); } catch (EmailException e) { throw LOG.addCcException(c, e); } } } }
protected internal virtual void setFrom(Email email, string from) { string fromAddress = null; if (!string.ReferenceEquals(from, null)) { fromAddress = from; } else { // use default configured from address in process engine config fromAddress = Context.ProcessEngineConfiguration.MailServerDefaultFrom; } try { email.From = fromAddress; } catch (EmailException e) { throw LOG.addSenderException(from, e); } }
protected internal virtual void addTo(Email email, string to) { string[] tos = splitAndTrim(to); if (tos != null) { foreach (string t in tos) { try { email.addTo(t); } catch (EmailException e) { throw LOG.addRecipientException(t, e); } } } else { throw LOG.missingRecipientsException(); } }
protected internal virtual void setSubject(Email email, string subject) { email.Subject = !string.ReferenceEquals(subject, null) ? subject : ""; }