AW: [opencms-dev] URGENT - CmsMailer and opencms.properties query
Petr Hollay
ph at ethikom.de
Thu Feb 19 18:47:02 CET 2004
Hi,
you know that SMTP server is already defined in registry.xml
and it is used (read) in constructors of CmsMail class.
In registry.xml, look for <smtpserver> element as subelement of <system>.
You can easily add into registry.xml something like:
<smtpserver-username>myusername</smtpserver-username>
<smtpserver-password>myusername</smtpserver- password >
after <smtpserver>my.smtp.server</smtpserver>.
Then it can be read in CmsMail (or your own class) using similar Java code
as "smtp" server is already read:
- after: c_MAILSERVER = reg.getSystemValue("smtpserver");
- add for example:
c_MAILSERVER_USERNAME = reg.getSystemValue("smtpserver-username");
c_MAILSERVER_PASSWORD = reg.getSystemValue("smtpserver-password");
(big letters only to be consistent with (little bit funny ;-) naming
conventions used there).
When using System.getProperties(), you are reading system properties.
See JDK docs for description how to work with them.
In this case you would need to use -D Java command line switch,
e.g.: -DmailUserName=myusername
This could be set using in your TOMCAT/bin/setenv.bat (or .sh on
Linux/Unix), using CATALINA_OPTS - see Tomcat how-to for this.
Ok?
Best regards
Petr
-----Ursprüngliche Nachricht-----
Von: opencms-dev-admin at opencms.org [mailto:opencms-dev-admin at opencms.org] Im
Auftrag von Alexander Kandzior
Gesendet: Donnerstag, 19. Februar 2004 09:45
An: opencms-dev at opencms.org
Betreff: RE: [opencms-dev] URGENT - CmsMailer and opencms.properties query
Trevor,
i'll tell you if you promise that you contribute your enhanced CmsMail class
;-)
Best Regards,
Alex.
Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com
> -----Original Message-----
> From: opencms-dev-admin at opencms.org
> [mailto:opencms-dev-admin at opencms.org] On Behalf Of Trevor Lee
> Sent: Thursday, February 19, 2004 6:43 AM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] URGENT - CmsMailer and opencms.properties query
>
>
> Hi all,
>
> I've modified CmsMail to use SMTP username/password
> authentication when it comes to sending emails via the Workflow.
>
> Now i want to add 3 variables (username, password and server)
> to the opencms.properties file. mailServer=xxx
> mailUserName=xxx mailPassword=xxx
>
> When i try to retrieve the properties in CmsMail.java using
> the following i get null for all variables: Properties props
> = System.getProperties(); String sMailServer =
> props.getProperty("mailServer"); String sUserName =
> props.getProperty("mailUserName");
> String sPassword = props.getProperty("mailPassword");
>
> 1. What java classes do i need to change to ensure these
> values are read from the properties file?
>
> 2. What do i need to do to retrieve the values from within
> the CmsMail?
>
> Thanks in advance for your help.
>
> Cheers
> Trevor
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list,
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
>
>
_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list