Package org.apache.turbine.util.mail

Examples of org.apache.turbine.util.mail.SimpleEmail


        try
        {
            // Process the template.
            String body = TurbineWebMacro.handleRequest(context,template);

            SimpleEmail se = new SimpleEmail();
            se.setFrom(fromEmail, fromName);
            se.addTo(toEmail, toName);
            se.setSubject(subject);
            se.setMsg(body);
            se.send();
        }
        catch (Exception e)
        {
            // Log the error.
            Log.error ("WebMacroEmail error: ", e);
View Full Code Here


            body = StringUtils.wrapText (body,
                                         System.getProperty("line.separator"),
                                         wordWrap);
        }

        SimpleEmail se = new SimpleEmail();
        se.setFrom(fromEmail, fromName);
        se.addTo(toEmail, toName);
        se.setSubject(subject);
        se.setMsg(body);
        se.send();
    }
View Full Code Here

                             .addQueryData("mode","update");
        try
        {
            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", data );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "userurl",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = JetspeedResources.getString("newuser.notification.language","en");
            String country = JetspeedResources.getString("newuser.notification.country","US");
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.notification.email.template");
            String templatePath = TemplateLocator.locateEmailTemplate(data, templateFile, locale);
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg(email_body.toString());

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (CustomLocalization.getString("SENDCONFIRMATIONEMAIL_SENT", data));
        } catch ( Exception e )
        {
            String errorTitle = CustomLocalization.getString("SENDCONFIRMATIONEMAIL_ERROR", data) ;
View Full Code Here

                loc = new Locale(lang,ctry);
            }

            String templatePath = TemplateLocator.locateEmailTemplate(data, JetspeedResources.getString("password.reminder.template"), loc);

            SimpleEmail se = new SimpleEmail();

            context.put("email",se);

            TurbineVelocity.handleRequest(context, templatePath, email_body);

            se.setMsg(email_body.toString());

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put("mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_SENT", rundata));
            logger.info( "Password for user " + user.getUserName() + " was sent to " + user.getEmail());
            logger.info(CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_SENT", rundata));
            data.setScreenTemplate("Login");
View Full Code Here

        try
        {
            //build body via template
            StringWriter email_body = new StringWriter();
            Context emailContext = TurbineVelocity.getContext(data);
            SimpleEmail se = new SimpleEmail();
            emailContext.put( "data", data );
            emailContext.put( "user", user );
            emailContext.put("config",new JetspeedResources());
            emailContext.put("urltojetspeed",url);
            emailContext.put("email",se);
            String templateFile = JetspeedResources.getString("newuser.confirm.email.template");
            String templatePath = TemplateLocator.locateEmailTemplate(data, templateFile);
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg( email_body.toString() );

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (CustomLocalization.getString("SENDCONFIRMATIONEMAIL_SENT", data));
        }
        catch ( Exception e )
        {
View Full Code Here

            DynamicURI url = new DynamicURI(rundata);

            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", rundata );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "urltojetspeed",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = (String)user.getPerm("language",TurbineResources.getString("locale.default.language", "en"));
            String country = (String)user.getPerm("country",TurbineResources.getString("locale.default.country", "US"));
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.approval.accept.template");
            String templatePath = TemplateLocator.locateEmailTemplate(rundata, templateFile, locale );
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg( email_body.toString() );

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();


        } catch (Exception e)
        {
            // log the error msg
View Full Code Here

            DynamicURI url = new DynamicURI(rundata);

            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", rundata );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "urltojetspeed",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = (String)user.getPerm("language",TurbineResources.getString("locale.default.language", "en"));
            String country = (String)user.getPerm("country",TurbineResources.getString("locale.default.country", "US"));
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.approval.reject.template");
            String templatePath = TemplateLocator.locateEmailTemplate(rundata, templateFile, locale );
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg( email_body.toString() );

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

        } catch (Exception e)
        {
            // log the error msg
              logger.error("Exception", e);
View Full Code Here

                             .addQueryData("mode","update");
        try
        {
            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", data );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "userurl",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = JetspeedResources.getString("newuser.notification.language","en");
            String country = JetspeedResources.getString("newuser.notification.country","US");
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.notification.email.template");
            String templatePath = TemplateLocator.locateEmailTemplate(data, templateFile, locale);
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg(email_body.toString());

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (Localization.getString(data, "SENDCONFIRMATIONEMAIL_SENT"));
        } catch ( Exception e )
        {
            String errorTitle = Localization.getString(data, "SENDCONFIRMATIONEMAIL_ERROR") ;
View Full Code Here

        try
        {
            //build body via template
            StringWriter email_body = new StringWriter();
            Context emailContext = TurbineVelocity.getContext(data);
            SimpleEmail se = new SimpleEmail();
            emailContext.put( "data", data );
            emailContext.put( "user", user );
            emailContext.put("config",new JetspeedResources());
            emailContext.put("urltojetspeed",url);
            emailContext.put("email",se);
            String templateFile = JetspeedResources.getString("newuser.confirm.email.template");
            String templatePath = TemplateLocator.locateEmailTemplate(data, templateFile);
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg( email_body.toString() );

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (Localization.getString(data, "SENDCONFIRMATIONEMAIL_SENT"));
        }
        catch ( Exception e )
        {
View Full Code Here

                loc = new Locale(lang,ctry);
            }

            String templatePath = TemplateLocator.locateEmailTemplate(data, JetspeedResources.getString("password.reminder.template"), loc);

            SimpleEmail se = new SimpleEmail();

            context.put("email",se);

            TurbineVelocity.handleRequest(context, templatePath, email_body);

            se.setMsg(email_body.toString());

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put("mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (Localization.getString(rundata, "JLOGINUSER_PASSWORDREMINDER_SENT"));
            logger.info( "Password for user " + user.getUserName() + " was sent to " + user.getEmail());
            logger.info(Localization.getString(rundata, "JLOGINUSER_PASSWORDREMINDER_SENT"));
            data.setScreenTemplate("Login");
View Full Code Here

TOP

Related Classes of org.apache.turbine.util.mail.SimpleEmail

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.