]> git.mxchange.org Git - addressbook-mailer-lib.git/blobdiff - src/org/mxchange/addressbook/mailer/model/delivery/AddressbookMailer.java
Continued a bit:
[addressbook-mailer-lib.git] / src / org / mxchange / addressbook / mailer / model / delivery / AddressbookMailer.java
index 98a8a0660f41f6df7a0a5edf172b9422e6d62668..772d855ef89c31c76f54cbc3e92cd5f825f22494 100644 (file)
@@ -23,7 +23,6 @@ import javax.mail.MessagingException;
 import javax.mail.Session;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
-import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jmailee.model.delivery.BaseMailer;
 import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
 
@@ -72,20 +71,17 @@ public class AddressbookMailer extends BaseMailer implements DeliverableAddressb
                } else if (emailWrapper.getLocale() == null) {
                        // Throw NPE again
                        throw new NullPointerException("emailWrapper.locale is null"); //NOI18N
+               } else if (!emailWrapper.getTemplateVariables().containsKey("baseUrl")) { //NOI18N
+                       // Not set
+                       throw new IllegalArgumentException("emailWrapper.templateVariables.baseUrl is not set"); //NOI18N
                }
 
                // All required data is set, load template
-               Template template = this.getTemplateEngine().getTemplate(String.format("./templates/%s/%s.vm", emailWrapper.getLocale().getLanguage().toLowerCase(), emailWrapper.getTemplateName())); //NOI18N
+               Template template = this.getTemplateEngine().getTemplate(String.format("templates/%s/%s.vm", emailWrapper.getLocale().getLanguage().toLowerCase(), emailWrapper.getTemplateName())); //NOI18N
 
                // Init context
                VelocityContext context = new VelocityContext();
 
-               // Get base URL from JSF
-               String baseUrl = FacesUtils.generateBaseUrl();
-
-               // ... and set it (for all templates the same)
-               context.put("baseUrl", baseUrl); //NOI18N
-
                // Are some variables set?
                if ((emailWrapper.getTemplateVariables() != null) && (!emailWrapper.getTemplateVariables().isEmpty())) {
                        // Add all variables