[NEW THREAD] email in viewprofile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[NEW THREAD] email in viewprofile

Jacques Le Roux
Administrator
Oops, I guess it should be better simple quotes inside the double quotes:

     </form><a class="buttontext"
href="javascript:document.createEmail${contactMech.infoString?replace('&#64;','')?replace('&#x40;','')?replace('.','')}.submit()">${uiLabelMap.CommonSendEmail}</a>


right? Please check, I did it locally but w/o email setting, so I could miss something

We will then need to amend trunk and back to R16

Thanks for report!

Jacques


Le 08/05/2018 à 14:04, Jacques Le Roux a écrit :

> Ralf,
>
> This was fixed w/ https://issues.apache.org/jira/browse/OFBIZ-7075 which was done before the R16 branch was released
>
> Please double check,
>
> I guess you are now subscribed to the dev ML? Please send only to the dev ML, no need to put me in copy
>
> Thanks
>
> Jacques
>
>
> Le 07/05/2018 à 23:11, [hidden email] a écrit :
>> The current version: Apache OFBiz 16.11.04.
>>
>> Ralf
>>
>>
>>
>>
>> Am 03.05.2018 um 08:48 schrieb Jacques Le Roux:
>>> Which version are you referring to?
>>>
>>> BTW your email has been moderated, please subscribe to the MLs:
>>> http://ofbiz.apache.org/mailing-lists.html
>>>
>>> Jacques
>>>
>>> 1
>>> Le 02/05/2018 à 15:08, [hidden email] a écrit :
>>>> Trying to configure E-Mail in OFBiz
>>>>
>>>> I had a look at this:
>>>>
>>>>     partymgr/control/viewprofile
>>>>
>>>> there is a button "send email", which does not seem to work.
>>>>
>>>> In Contact.ftl (Line 96) there is a JavaScript  call
>>>> which seems to have missing quotes and maybe a problem
>>>> with formatting the E-Mail-address.
>>>>
>>>>
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Ralf
>>>>
>>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Send E-Mails

info@agentur-m3.de
Hello,

here is a problem with my e-mail base-configuration.

I configured email according to the setup guide:

https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide#ApacheOFBizTechnicalProductionSetupGuide-EmailServerSettings


Unfortunately no email seems to be sent from server
(the send email button in partymgr works fine now (thanks to Jacques!),
but no email reaches client). No error message, no error in log.

Also I tried to register in the ecommerce system and send
an "Forgot Your Password" email, but none of the emails were sent.

To get more info about the problem, I wrote a groovy script and copied
parts of the sendEmail-code from EmailServices.java.
The script below surprisingly works fine and sends emails!

So I don't understand, why OFBiz itself does not send mails.
Is there any further configuration necessary?



The script (which sends mails):

import javax.mail.Session;

import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.SendFailedException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.stream.StreamSource;

import org.apache.fop.apps.Fop;
import org.apache.fop.apps.MimeConstants;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
import org.apache.ofbiz.base.util.HttpClient;
import org.apache.ofbiz.base.util.HttpClientException;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilProperties;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.base.util.collections.MapStack;
import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.entity.GenericValue;
import org.apache.ofbiz.entity.util.EntityUtilProperties;
import org.apache.ofbiz.service.DispatchContext;
import org.apache.ofbiz.service.GenericServiceException;
import org.apache.ofbiz.service.LocalDispatcher;
import org.apache.ofbiz.service.ServiceUtil;
import org.apache.ofbiz.service.mail.MimeMessageWrapper;
import org.apache.ofbiz.webapp.view.ApacheFopWorker;
import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
import org.apache.ofbiz.widget.renderer.ScreenRenderer;
import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
import org.xml.sax.SAXException;

def testMail() {
        sendType = "mail.smtp.host"
        sendVia = "smtp.myhost.com"
        Properties props = System.getProperties()
    props.put(sendType, sendVia)
    Session session
    session = Session.getInstance(props);
    MimeMessage mail
    mail = new MimeMessage(session);
        Transport trans = null
        sendFrom = "obfiz.example.com"
        sendTo = "[hidden email]"
        subject = "testMail from OFBiz"
        mp = new MimeMultipart();
       
        MimeBodyPart mbp = new MimeBodyPart();
        mbp.setText("Content: a test mail from OFBiz system")
       
        mp.addBodyPart(mbp);
        mail.setContent(mp);
       
        mail.setFrom(new InternetAddress(sendFrom));
        mail.setSubject(subject, "UTF-8");
        mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business Project");
        mail.setSentDate(new Date());
        mail.addRecipients(Message.RecipientType.TO, sendTo);
       
        trans = session.getTransport("smtp")
        authUser = UtilProperties.getPropertyValue('general.properties',
'mail.smtp.auth.user')
        authPass = UtilProperties.getPropertyValue('general.properties',
'mail.smtp.auth.password')

    trans.connect(sendVia, authUser, authPass);
        trans.sendMessage(mail, mail.getAllRecipients())
        trans.close()
       
        logWarning("successful run of testMail ")
        logWarning(" user = " + userLogin.partyId);

  return success("this test is done successful")  
}
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Jacques Le Roux
Administrator
Thanks for report, I committed the fix for OFBIZ-7075

I confirm it seems there is an issue. I configured general.properties to be able to send an email. All seems to work

2018-05-09 10:13:11,370 |jsse-nio-8443-exec-8 |ControlServlet                |T| [[[sendCommunicationEvent(Domain:https://localhost)] Request Begun,
encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
2018-05-09 10:13:11,377 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/partyCommunicationEventPermissionCheck]
finished in [1] milliseconds
2018-05-09 10:13:11,403 |jsse-nio-8443-exec-8 |ModelService                  |I| Set default value [N] for parameter [setRoleStatusToComplete]
2018-05-09 10:13:11,404 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/partyCommunicationEventPermissionCheck]
finished in [1] milliseconds
2018-05-09 10:13:11,425 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/setCommunicationEventStatus] finished in [22]
milliseconds
2018-05-09 10:13:11,425 |jsse-nio-8443-exec-8 |ServiceEcaRule                |I| For Service ECA [updateCommunicationEvent] on [commit] got false for
condition: [statusId][equals][COM_ENTERED][true][String]
2018-05-09 10:13:11,425 |jsse-nio-8443-exec-8 |ServiceEcaRule                |I| For Service ECA [updateCommunicationEvent] on [commit] got false for
condition: [statusId][equals][COM_ENTERED][true][String]
2018-05-09 10:13:11,425 |jsse-nio-8443-exec-8 |ServiceEcaRule                |I| For Service ECA [updateCommunicationEvent] on [commit] got false for
condition: [statusId][equals][COM_ENTERED][true][String]
2018-05-09 10:13:11,425 |jsse-nio-8443-exec-8 |ServiceEcaCondition           |I| To Field (oldStatusId) is not found in context for
updateCommunicationEvent, defaulting to null.
2018-05-09 10:13:11,426 |jsse-nio-8443-exec-8 |ServiceEcaRule                |I| Running Service ECA Service: updateCommStatusFromCommEvent, triggered
by rule on Service: updateCommunicationEvent
2018-05-09 10:13:11,448 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/updateCommStatusFromCommEvent] finished in
[22] milliseconds
2018-05-09 10:13:11,448 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/updateCommunicationEvent] finished in [72]
milliseconds
2018-05-09 10:13:11,448 |jsse-nio-8443-exec-8 |RequestHandler                |I| Ran Event [service:#updateCommunicationEvent] from [request], result
is [success]
2018-05-09 10:13:11,449 |jsse-nio-8443-exec-8 |RequestHandler                |I| Rendering View [EditCommunicationEvent].  Hidden sessionId by default.
2018-05-09 10:13:11,452 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/getUserPreferenceGroup] finished in [2]
milliseconds
2018-05-09 10:13:11,462 |jsse-nio-8443-exec-8 |ScreenFactory                 |I| Got 28 screens in 0.009s from:
file:/C:/projectsASF/ofbiz/applications/party/widget/partymgr/CommunicationEventScreens.xml
2018-05-09 10:13:11,500 |jsse-nio-8443-exec-8 |ScreenFactory                 |I| Got 4 screens in 0.005s from:
file:/C:/projectsASF/ofbiz/applications/party/widget/partymgr/CommonScreens.xml
2018-05-09 10:13:11,506 |jsse-nio-8443-exec-8 |ScreenFactory                 |I| Got 1 screens in 0.005s from:
file:/C:/projectsASF/ofbiz/applications/commonext/widget/CommonScreens.xml
2018-05-09 10:13:11,544 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/getLastSystemInfoNote] finished in [11]
milliseconds
2018-05-09 10:13:11,614 |jsse-nio-8443-exec-8 |Log                           |W| [CommonPermissionServices.xml#genericBasePermissionCheck line 59]
This simple-method-call is deprecated! Please use a service-call of genericBasePermissionCheck instead.
2018-05-09 10:13:11,615 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/genericBasePermissionCheck] finished in [1]
milliseconds
2018-05-09 10:13:11,615 |jsse-nio-8443-exec-8 |ServiceEcaRule                |I| For Service ECA [partyBasePermissionCheck] on [return] got false for
condition: [hasPermission][equals][false][true][Boolean]
2018-05-09 10:13:11,615 |jsse-nio-8443-exec-8 |ServiceDispatcher             |T| Sync service [partymgr/partyBasePermissionCheck] finished in [6]
milliseconds
2018-05-09 10:13:11,895 |jsse-nio-8443-exec-8 |ServerHitBin                  |I| Visit delegatorName=default, ServerHitBin delegatorName=default
2018-05-09 10:13:11,900 |jsse-nio-8443-exec-8 |ControlServlet                |T| [[[sendCommunicationEvent(Domain:https://localhost)] Request Done-
total:0.53,since last([sendCommunicatio...):0.53]]

But I did not receive an email.

I'll try to have a look when I get a chance...

Jacques

Le 09/05/2018 à 00:03, [hidden email] a écrit :

> Hello,
>
> here is a problem with my e-mail base-configuration.
>
> I configured email according to the setup guide:
>
> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide#ApacheOFBizTechnicalProductionSetupGuide-EmailServerSettings
>
>
> Unfortunately no email seems to be sent from server
> (the send email button in partymgr works fine now (thanks to Jacques!),
> but no email reaches client). No error message, no error in log.
>
> Also I tried to register in the ecommerce system and send
> an "Forgot Your Password" email, but none of the emails were sent.
>
> To get more info about the problem, I wrote a groovy script and copied
> parts of the sendEmail-code from EmailServices.java.
> The script below surprisingly works fine and sends emails!
>
> So I don't understand, why OFBiz itself does not send mails.
> Is there any further configuration necessary?
>
>
>
> The script (which sends mails):
>
> import javax.mail.Session;
>
> import javax.activation.DataHandler;
> import javax.activation.DataSource;
> import javax.mail.Message;
> import javax.mail.MessagingException;
> import javax.mail.SendFailedException;
> import javax.mail.Session;
> import javax.mail.Transport;
> import javax.mail.internet.InternetAddress;
> import javax.mail.internet.MimeBodyPart;
> import javax.mail.internet.MimeMessage;
> import javax.mail.internet.MimeMultipart;
> import javax.xml.parsers.ParserConfigurationException;
> import javax.xml.transform.stream.StreamSource;
>
> import org.apache.fop.apps.Fop;
> import org.apache.fop.apps.MimeConstants;
> import org.apache.ofbiz.base.util.Debug;
> import org.apache.ofbiz.base.util.GeneralException;
> import org.apache.ofbiz.base.util.HttpClient;
> import org.apache.ofbiz.base.util.HttpClientException;
> import org.apache.ofbiz.base.util.UtilGenerics;
> import org.apache.ofbiz.base.util.UtilMisc;
> import org.apache.ofbiz.base.util.UtilProperties;
> import org.apache.ofbiz.base.util.UtilValidate;
> import org.apache.ofbiz.base.util.collections.MapStack;
> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> import org.apache.ofbiz.entity.Delegator;
> import org.apache.ofbiz.entity.GenericValue;
> import org.apache.ofbiz.entity.util.EntityUtilProperties;
> import org.apache.ofbiz.service.DispatchContext;
> import org.apache.ofbiz.service.GenericServiceException;
> import org.apache.ofbiz.service.LocalDispatcher;
> import org.apache.ofbiz.service.ServiceUtil;
> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> import org.xml.sax.SAXException;
>
> def testMail() {
> sendType = "mail.smtp.host"
> sendVia = "smtp.myhost.com"
> Properties props = System.getProperties()
>      props.put(sendType, sendVia)
>      Session session
>      session = Session.getInstance(props);
>      MimeMessage mail
>      mail = new MimeMessage(session);
> Transport trans = null
> sendFrom = "obfiz.example.com"
> sendTo = "[hidden email]"
> subject = "testMail from OFBiz"
> mp = new MimeMultipart();
>
> MimeBodyPart mbp = new MimeBodyPart();
> mbp.setText("Content: a test mail from OFBiz system")
>
> mp.addBodyPart(mbp);
> mail.setContent(mp);
>
> mail.setFrom(new InternetAddress(sendFrom));
> mail.setSubject(subject, "UTF-8");
> mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business Project");
> mail.setSentDate(new Date());
> mail.addRecipients(Message.RecipientType.TO, sendTo);
>
> trans = session.getTransport("smtp")
> authUser = UtilProperties.getPropertyValue('general.properties',
> 'mail.smtp.auth.user')
> authPass = UtilProperties.getPropertyValue('general.properties',
> 'mail.smtp.auth.password')
>
>      trans.connect(sendVia, authUser, authPass);
> trans.sendMessage(mail, mail.getAllRecipients())
> trans.close()
>
> logWarning("successful run of testMail ")
> logWarning(" user = " + userLogin.partyId);
>
>   return success("this test is done successful")  
> }
>

Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Rishi Solanki
In reply to this post by info@agentur-m3.de
Hello,

Can you please check the SystemProperty records with
systemResourceId="general". Possible reason seems these records may have
empty values at your end. The db values used to override the
general.properties file mentioned in the Production Setup Guide. Please add
your configuration if it is missing and let us know if it works.

Community, I think we should mention the SystemProperty where required in
Production Setup Guide or may be we can add version of production setup
guide which will tells user upto which release this production setup guide
will work. I know we discuss this kind of effort in past for all the
documents and we agree on some point. But this is quicker to manage
Production Setup Guide, if we agree then I can do it.

I'm fine with either change the existing one or maintain the version. But
first we should have one which works always with latest. Thanks!


Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com
www.hotwax.co

On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
wrote:

> Hello,
>
> here is a problem with my e-mail base-configuration.
>
> I configured email according to the setup guide:
>
> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> Production+Setup+Guide#ApacheOFBizTechnicalProduction
> SetupGuide-EmailServerSettings
>
>
> Unfortunately no email seems to be sent from server
> (the send email button in partymgr works fine now (thanks to Jacques!),
> but no email reaches client). No error message, no error in log.
>
> Also I tried to register in the ecommerce system and send
> an "Forgot Your Password" email, but none of the emails were sent.
>
> To get more info about the problem, I wrote a groovy script and copied
> parts of the sendEmail-code from EmailServices.java.
> The script below surprisingly works fine and sends emails!
>
> So I don't understand, why OFBiz itself does not send mails.
> Is there any further configuration necessary?
>
>
>
> The script (which sends mails):
>
> import javax.mail.Session;
>
> import javax.activation.DataHandler;
> import javax.activation.DataSource;
> import javax.mail.Message;
> import javax.mail.MessagingException;
> import javax.mail.SendFailedException;
> import javax.mail.Session;
> import javax.mail.Transport;
> import javax.mail.internet.InternetAddress;
> import javax.mail.internet.MimeBodyPart;
> import javax.mail.internet.MimeMessage;
> import javax.mail.internet.MimeMultipart;
> import javax.xml.parsers.ParserConfigurationException;
> import javax.xml.transform.stream.StreamSource;
>
> import org.apache.fop.apps.Fop;
> import org.apache.fop.apps.MimeConstants;
> import org.apache.ofbiz.base.util.Debug;
> import org.apache.ofbiz.base.util.GeneralException;
> import org.apache.ofbiz.base.util.HttpClient;
> import org.apache.ofbiz.base.util.HttpClientException;
> import org.apache.ofbiz.base.util.UtilGenerics;
> import org.apache.ofbiz.base.util.UtilMisc;
> import org.apache.ofbiz.base.util.UtilProperties;
> import org.apache.ofbiz.base.util.UtilValidate;
> import org.apache.ofbiz.base.util.collections.MapStack;
> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> import org.apache.ofbiz.entity.Delegator;
> import org.apache.ofbiz.entity.GenericValue;
> import org.apache.ofbiz.entity.util.EntityUtilProperties;
> import org.apache.ofbiz.service.DispatchContext;
> import org.apache.ofbiz.service.GenericServiceException;
> import org.apache.ofbiz.service.LocalDispatcher;
> import org.apache.ofbiz.service.ServiceUtil;
> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> import org.xml.sax.SAXException;
>
> def testMail() {
>         sendType = "mail.smtp.host"
>         sendVia = "smtp.myhost.com"
>         Properties props = System.getProperties()
>     props.put(sendType, sendVia)
>     Session session
>     session = Session.getInstance(props);
>     MimeMessage mail
>     mail = new MimeMessage(session);
>         Transport trans = null
>         sendFrom = "obfiz.example.com"
>         sendTo = "[hidden email]"
>         subject = "testMail from OFBiz"
>         mp = new MimeMultipart();
>
>         MimeBodyPart mbp = new MimeBodyPart();
>         mbp.setText("Content: a test mail from OFBiz system")
>
>         mp.addBodyPart(mbp);
>         mail.setContent(mp);
>
>         mail.setFrom(new InternetAddress(sendFrom));
>         mail.setSubject(subject, "UTF-8");
>         mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
> Project");
>         mail.setSentDate(new Date());
>         mail.addRecipients(Message.RecipientType.TO, sendTo);
>
>         trans = session.getTransport("smtp")
>         authUser = UtilProperties.getPropertyValue('general.properties',
> 'mail.smtp.auth.user')
>         authPass = UtilProperties.getPropertyValue('general.properties',
> 'mail.smtp.auth.password')
>
>     trans.connect(sendVia, authUser, authPass);
>         trans.sendMessage(mail, mail.getAllRecipients())
>         trans.close()
>
>         logWarning("successful run of testMail ")
>         logWarning(" user = " + userLogin.partyId);
>
>         return success("this test is done successful")
> }
>
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

info@agentur-m3.de
Hello,

I checked SystemProperty table: as you assumed, the auth-values where
empty. So I copied the values for some variables from general.properties:

  mail.smtp.auth.password
  mail.smtp.auth.user
  mail.smtp.relay.host

and set mail.notifications.enabled to Y
.

But still I do not receive an email.





Am 09.05.2018 um 11:12 schrieb Rishi Solanki:

> Hello,
>
> Can you please check the SystemProperty records with
> systemResourceId="general". Possible reason seems these records may have
> empty values at your end. The db values used to override the
> general.properties file mentioned in the Production Setup Guide. Please add
> your configuration if it is missing and let us know if it works.
>
> Community, I think we should mention the SystemProperty where required in
> Production Setup Guide or may be we can add version of production setup
> guide which will tells user upto which release this production setup guide
> will work. I know we discuss this kind of effort in past for all the
> documents and we agree on some point. But this is quicker to manage
> Production Setup Guide, if we agree then I can do it.
>
> I'm fine with either change the existing one or maintain the version. But
> first we should have one which works always with latest. Thanks!
>
>
> Rishi Solanki
> Sr Manager, Enterprise Software Development
> HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
> www.hotwax.co
>
> On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
> wrote:
>
>> Hello,
>>
>> here is a problem with my e-mail base-configuration.
>>
>> I configured email according to the setup guide:
>>
>> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
>> Production+Setup+Guide#ApacheOFBizTechnicalProduction
>> SetupGuide-EmailServerSettings
>>
>>
>> Unfortunately no email seems to be sent from server
>> (the send email button in partymgr works fine now (thanks to Jacques!),
>> but no email reaches client). No error message, no error in log.
>>
>> Also I tried to register in the ecommerce system and send
>> an "Forgot Your Password" email, but none of the emails were sent.
>>
>> To get more info about the problem, I wrote a groovy script and copied
>> parts of the sendEmail-code from EmailServices.java.
>> The script below surprisingly works fine and sends emails!
>>
>> So I don't understand, why OFBiz itself does not send mails.
>> Is there any further configuration necessary?
>>
>>
>>
>> The script (which sends mails):
>>
>> import javax.mail.Session;
>>
>> import javax.activation.DataHandler;
>> import javax.activation.DataSource;
>> import javax.mail.Message;
>> import javax.mail.MessagingException;
>> import javax.mail.SendFailedException;
>> import javax.mail.Session;
>> import javax.mail.Transport;
>> import javax.mail.internet.InternetAddress;
>> import javax.mail.internet.MimeBodyPart;
>> import javax.mail.internet.MimeMessage;
>> import javax.mail.internet.MimeMultipart;
>> import javax.xml.parsers.ParserConfigurationException;
>> import javax.xml.transform.stream.StreamSource;
>>
>> import org.apache.fop.apps.Fop;
>> import org.apache.fop.apps.MimeConstants;
>> import org.apache.ofbiz.base.util.Debug;
>> import org.apache.ofbiz.base.util.GeneralException;
>> import org.apache.ofbiz.base.util.HttpClient;
>> import org.apache.ofbiz.base.util.HttpClientException;
>> import org.apache.ofbiz.base.util.UtilGenerics;
>> import org.apache.ofbiz.base.util.UtilMisc;
>> import org.apache.ofbiz.base.util.UtilProperties;
>> import org.apache.ofbiz.base.util.UtilValidate;
>> import org.apache.ofbiz.base.util.collections.MapStack;
>> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
>> import org.apache.ofbiz.entity.Delegator;
>> import org.apache.ofbiz.entity.GenericValue;
>> import org.apache.ofbiz.entity.util.EntityUtilProperties;
>> import org.apache.ofbiz.service.DispatchContext;
>> import org.apache.ofbiz.service.GenericServiceException;
>> import org.apache.ofbiz.service.LocalDispatcher;
>> import org.apache.ofbiz.service.ServiceUtil;
>> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
>> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
>> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
>> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
>> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
>> import org.xml.sax.SAXException;
>>
>> def testMail() {
>>         sendType = "mail.smtp.host"
>>         sendVia = "smtp.myhost.com"
>>         Properties props = System.getProperties()
>>     props.put(sendType, sendVia)
>>     Session session
>>     session = Session.getInstance(props);
>>     MimeMessage mail
>>     mail = new MimeMessage(session);
>>         Transport trans = null
>>         sendFrom = "obfiz.example.com"
>>         sendTo = "[hidden email]"
>>         subject = "testMail from OFBiz"
>>         mp = new MimeMultipart();
>>
>>         MimeBodyPart mbp = new MimeBodyPart();
>>         mbp.setText("Content: a test mail from OFBiz system")
>>
>>         mp.addBodyPart(mbp);
>>         mail.setContent(mp);
>>
>>         mail.setFrom(new InternetAddress(sendFrom));
>>         mail.setSubject(subject, "UTF-8");
>>         mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
>> Project");
>>         mail.setSentDate(new Date());
>>         mail.addRecipients(Message.RecipientType.TO, sendTo);
>>
>>         trans = session.getTransport("smtp")
>>         authUser = UtilProperties.getPropertyValue('general.properties',
>> 'mail.smtp.auth.user')
>>         authPass = UtilProperties.getPropertyValue('general.properties',
>> 'mail.smtp.auth.password')
>>
>>     trans.connect(sendVia, authUser, authPass);
>>         trans.sendMessage(mail, mail.getAllRecipients())
>>         trans.close()
>>
>>         logWarning("successful run of testMail ")
>>         logWarning(" user = " + userLogin.partyId);
>>
>>         return success("this test is done successful")
>> }
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Jacques Le Roux
Administrator
In reply to this post by Rishi Solanki
Hi Rishi,


Le 09/05/2018 à 11:12, Rishi Solanki a écrit :
> Community, I think we should mention the SystemProperty where required in
> Production Setup Guide or may be we can add version of production setup
> guide which will tells user upto which release this production setup guide
> will work. I know we discuss this kind of effort in past for all the
> documents and we agree on some point. But this is quicker to manage
> Production Setup Guide, if we agree then I can do it.
Yes good idea, a simple information for concerned versions in the current Production Setup Guide fits with me

Jacques

>
> I'm fine with either change the existing one or maintain the version. But
> first we should have one which works always with latest. Thanks!
>
>
> Rishi Solanki
> Sr Manager, Enterprise Software Development
> HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
> www.hotwax.co
>
> On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
> wrote:
>
>> Hello,
>>
>> here is a problem with my e-mail base-configuration.
>>
>> I configured email according to the setup guide:
>>
>> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
>> Production+Setup+Guide#ApacheOFBizTechnicalProduction
>> SetupGuide-EmailServerSettings
>>
>>
>> Unfortunately no email seems to be sent from server
>> (the send email button in partymgr works fine now (thanks to Jacques!),
>> but no email reaches client). No error message, no error in log.
>>
>> Also I tried to register in the ecommerce system and send
>> an "Forgot Your Password" email, but none of the emails were sent.
>>
>> To get more info about the problem, I wrote a groovy script and copied
>> parts of the sendEmail-code from EmailServices.java.
>> The script below surprisingly works fine and sends emails!
>>
>> So I don't understand, why OFBiz itself does not send mails.
>> Is there any further configuration necessary?
>>
>>
>>
>> The script (which sends mails):
>>
>> import javax.mail.Session;
>>
>> import javax.activation.DataHandler;
>> import javax.activation.DataSource;
>> import javax.mail.Message;
>> import javax.mail.MessagingException;
>> import javax.mail.SendFailedException;
>> import javax.mail.Session;
>> import javax.mail.Transport;
>> import javax.mail.internet.InternetAddress;
>> import javax.mail.internet.MimeBodyPart;
>> import javax.mail.internet.MimeMessage;
>> import javax.mail.internet.MimeMultipart;
>> import javax.xml.parsers.ParserConfigurationException;
>> import javax.xml.transform.stream.StreamSource;
>>
>> import org.apache.fop.apps.Fop;
>> import org.apache.fop.apps.MimeConstants;
>> import org.apache.ofbiz.base.util.Debug;
>> import org.apache.ofbiz.base.util.GeneralException;
>> import org.apache.ofbiz.base.util.HttpClient;
>> import org.apache.ofbiz.base.util.HttpClientException;
>> import org.apache.ofbiz.base.util.UtilGenerics;
>> import org.apache.ofbiz.base.util.UtilMisc;
>> import org.apache.ofbiz.base.util.UtilProperties;
>> import org.apache.ofbiz.base.util.UtilValidate;
>> import org.apache.ofbiz.base.util.collections.MapStack;
>> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
>> import org.apache.ofbiz.entity.Delegator;
>> import org.apache.ofbiz.entity.GenericValue;
>> import org.apache.ofbiz.entity.util.EntityUtilProperties;
>> import org.apache.ofbiz.service.DispatchContext;
>> import org.apache.ofbiz.service.GenericServiceException;
>> import org.apache.ofbiz.service.LocalDispatcher;
>> import org.apache.ofbiz.service.ServiceUtil;
>> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
>> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
>> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
>> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
>> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
>> import org.xml.sax.SAXException;
>>
>> def testMail() {
>>          sendType = "mail.smtp.host"
>>          sendVia = "smtp.myhost.com"
>>          Properties props = System.getProperties()
>>      props.put(sendType, sendVia)
>>      Session session
>>      session = Session.getInstance(props);
>>      MimeMessage mail
>>      mail = new MimeMessage(session);
>>          Transport trans = null
>>          sendFrom = "obfiz.example.com"
>>          sendTo = "[hidden email]"
>>          subject = "testMail from OFBiz"
>>          mp = new MimeMultipart();
>>
>>          MimeBodyPart mbp = new MimeBodyPart();
>>          mbp.setText("Content: a test mail from OFBiz system")
>>
>>          mp.addBodyPart(mbp);
>>          mail.setContent(mp);
>>
>>          mail.setFrom(new InternetAddress(sendFrom));
>>          mail.setSubject(subject, "UTF-8");
>>          mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
>> Project");
>>          mail.setSentDate(new Date());
>>          mail.addRecipients(Message.RecipientType.TO, sendTo);
>>
>>          trans = session.getTransport("smtp")
>>          authUser = UtilProperties.getPropertyValue('general.properties',
>> 'mail.smtp.auth.user')
>>          authPass = UtilProperties.getPropertyValue('general.properties',
>> 'mail.smtp.auth.password')
>>
>>      trans.connect(sendVia, authUser, authPass);
>>          trans.sendMessage(mail, mail.getAllRecipients())
>>          trans.close()
>>
>>          logWarning("successful run of testMail ")
>>          logWarning(" user = " + userLogin.partyId);
>>
>>          return success("this test is done successful")
>> }
>>

Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

taher
Actually, I think whatever need to be documented is best placed in our
embedded documentation. We should probably consider freezing all new
documentation in any place that is not the embedded documentation and try
to migrate everything to it. So email setting docs could be placed
somewhere in our user manual.

On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <[hidden email]>
wrote:

> Hi Rishi,
>
>
> Le 09/05/2018 à 11:12, Rishi Solanki a écrit :
> > Community, I think we should mention the SystemProperty where required in
> > Production Setup Guide or may be we can add version of production setup
> > guide which will tells user upto which release this production setup
> guide
> > will work. I know we discuss this kind of effort in past for all the
> > documents and we agree on some point. But this is quicker to manage
> > Production Setup Guide, if we agree then I can do it.
> Yes good idea, a simple information for concerned versions in the current
> Production Setup Guide fits with me
>
> Jacques
> >
> > I'm fine with either change the existing one or maintain the version. But
> > first we should have one which works always with latest. Thanks!
> >
> >
> > Rishi Solanki
> > Sr Manager, Enterprise Software Development
> > HotWax Systems Pvt. Ltd.
> > Direct: +91-9893287847
> > http://www.hotwaxsystems.com
> > www.hotwax.co
> >
> > On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
> > wrote:
> >
> >> Hello,
> >>
> >> here is a problem with my e-mail base-configuration.
> >>
> >> I configured email according to the setup guide:
> >>
> >>
> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> >> Production+Setup+Guide#ApacheOFBizTechnicalProduction
> >> SetupGuide-EmailServerSettings
> >>
> >>
> >> Unfortunately no email seems to be sent from server
> >> (the send email button in partymgr works fine now (thanks to Jacques!),
> >> but no email reaches client). No error message, no error in log.
> >>
> >> Also I tried to register in the ecommerce system and send
> >> an "Forgot Your Password" email, but none of the emails were sent.
> >>
> >> To get more info about the problem, I wrote a groovy script and copied
> >> parts of the sendEmail-code from EmailServices.java.
> >> The script below surprisingly works fine and sends emails!
> >>
> >> So I don't understand, why OFBiz itself does not send mails.
> >> Is there any further configuration necessary?
> >>
> >>
> >>
> >> The script (which sends mails):
> >>
> >> import javax.mail.Session;
> >>
> >> import javax.activation.DataHandler;
> >> import javax.activation.DataSource;
> >> import javax.mail.Message;
> >> import javax.mail.MessagingException;
> >> import javax.mail.SendFailedException;
> >> import javax.mail.Session;
> >> import javax.mail.Transport;
> >> import javax.mail.internet.InternetAddress;
> >> import javax.mail.internet.MimeBodyPart;
> >> import javax.mail.internet.MimeMessage;
> >> import javax.mail.internet.MimeMultipart;
> >> import javax.xml.parsers.ParserConfigurationException;
> >> import javax.xml.transform.stream.StreamSource;
> >>
> >> import org.apache.fop.apps.Fop;
> >> import org.apache.fop.apps.MimeConstants;
> >> import org.apache.ofbiz.base.util.Debug;
> >> import org.apache.ofbiz.base.util.GeneralException;
> >> import org.apache.ofbiz.base.util.HttpClient;
> >> import org.apache.ofbiz.base.util.HttpClientException;
> >> import org.apache.ofbiz.base.util.UtilGenerics;
> >> import org.apache.ofbiz.base.util.UtilMisc;
> >> import org.apache.ofbiz.base.util.UtilProperties;
> >> import org.apache.ofbiz.base.util.UtilValidate;
> >> import org.apache.ofbiz.base.util.collections.MapStack;
> >> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> >> import org.apache.ofbiz.entity.Delegator;
> >> import org.apache.ofbiz.entity.GenericValue;
> >> import org.apache.ofbiz.entity.util.EntityUtilProperties;
> >> import org.apache.ofbiz.service.DispatchContext;
> >> import org.apache.ofbiz.service.GenericServiceException;
> >> import org.apache.ofbiz.service.LocalDispatcher;
> >> import org.apache.ofbiz.service.ServiceUtil;
> >> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> >> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> >> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> >> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> >> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> >> import org.xml.sax.SAXException;
> >>
> >> def testMail() {
> >>          sendType = "mail.smtp.host"
> >>          sendVia = "smtp.myhost.com"
> >>          Properties props = System.getProperties()
> >>      props.put(sendType, sendVia)
> >>      Session session
> >>      session = Session.getInstance(props);
> >>      MimeMessage mail
> >>      mail = new MimeMessage(session);
> >>          Transport trans = null
> >>          sendFrom = "obfiz.example.com"
> >>          sendTo = "[hidden email]"
> >>          subject = "testMail from OFBiz"
> >>          mp = new MimeMultipart();
> >>
> >>          MimeBodyPart mbp = new MimeBodyPart();
> >>          mbp.setText("Content: a test mail from OFBiz system")
> >>
> >>          mp.addBodyPart(mbp);
> >>          mail.setContent(mp);
> >>
> >>          mail.setFrom(new InternetAddress(sendFrom));
> >>          mail.setSubject(subject, "UTF-8");
> >>          mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
> >> Project");
> >>          mail.setSentDate(new Date());
> >>          mail.addRecipients(Message.RecipientType.TO, sendTo);
> >>
> >>          trans = session.getTransport("smtp")
> >>          authUser =
> UtilProperties.getPropertyValue('general.properties',
> >> 'mail.smtp.auth.user')
> >>          authPass =
> UtilProperties.getPropertyValue('general.properties',
> >> 'mail.smtp.auth.password')
> >>
> >>      trans.connect(sendVia, authUser, authPass);
> >>          trans.sendMessage(mail, mail.getAllRecipients())
> >>          trans.close()
> >>
> >>          logWarning("successful run of testMail ")
> >>          logWarning(" user = " + userLogin.partyId);
> >>
> >>          return success("this test is done successful")
> >> }
> >>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Gil Portenseigne
Hello there,

Do somes actions have been taken on documenting the existence of
SystemProperty ?

I like the idea of migrating documentation into embedded one.

I just wanted to add a note into https://s.apache.org/BPJ5 that alert
about SystemProperty, but i seem to miss the modification permission...
can someone grant me access ?

Thanks

Gil


Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :

> Actually, I think whatever need to be documented is best placed in our
> embedded documentation. We should probably consider freezing all new
> documentation in any place that is not the embedded documentation and try
> to migrate everything to it. So email setting docs could be placed
> somewhere in our user manual.
>
> On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <[hidden email]>
> wrote:
>
> > Hi Rishi,
> >
> >
> > Le 09/05/2018 à 11:12, Rishi Solanki a écrit :
> > > Community, I think we should mention the SystemProperty where required in
> > > Production Setup Guide or may be we can add version of production setup
> > > guide which will tells user upto which release this production setup
> > guide
> > > will work. I know we discuss this kind of effort in past for all the
> > > documents and we agree on some point. But this is quicker to manage
> > > Production Setup Guide, if we agree then I can do it.
> > Yes good idea, a simple information for concerned versions in the current
> > Production Setup Guide fits with me
> >
> > Jacques
> > >
> > > I'm fine with either change the existing one or maintain the version. But
> > > first we should have one which works always with latest. Thanks!
> > >
> > >
> > > Rishi Solanki
> > > Sr Manager, Enterprise Software Development
> > > HotWax Systems Pvt. Ltd.
> > > Direct: +91-9893287847
> > > http://www.hotwaxsystems.com
> > > www.hotwax.co
> > >
> > > On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
> > > wrote:
> > >
> > >> Hello,
> > >>
> > >> here is a problem with my e-mail base-configuration.
> > >>
> > >> I configured email according to the setup guide:
> > >>
> > >>
> > https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> > >> Production+Setup+Guide#ApacheOFBizTechnicalProduction
> > >> SetupGuide-EmailServerSettings
> > >>
> > >>
> > >> Unfortunately no email seems to be sent from server
> > >> (the send email button in partymgr works fine now (thanks to Jacques!),
> > >> but no email reaches client). No error message, no error in log.
> > >>
> > >> Also I tried to register in the ecommerce system and send
> > >> an "Forgot Your Password" email, but none of the emails were sent.
> > >>
> > >> To get more info about the problem, I wrote a groovy script and copied
> > >> parts of the sendEmail-code from EmailServices.java.
> > >> The script below surprisingly works fine and sends emails!
> > >>
> > >> So I don't understand, why OFBiz itself does not send mails.
> > >> Is there any further configuration necessary?
> > >>
> > >>
> > >>
> > >> The script (which sends mails):
> > >>
> > >> import javax.mail.Session;
> > >>
> > >> import javax.activation.DataHandler;
> > >> import javax.activation.DataSource;
> > >> import javax.mail.Message;
> > >> import javax.mail.MessagingException;
> > >> import javax.mail.SendFailedException;
> > >> import javax.mail.Session;
> > >> import javax.mail.Transport;
> > >> import javax.mail.internet.InternetAddress;
> > >> import javax.mail.internet.MimeBodyPart;
> > >> import javax.mail.internet.MimeMessage;
> > >> import javax.mail.internet.MimeMultipart;
> > >> import javax.xml.parsers.ParserConfigurationException;
> > >> import javax.xml.transform.stream.StreamSource;
> > >>
> > >> import org.apache.fop.apps.Fop;
> > >> import org.apache.fop.apps.MimeConstants;
> > >> import org.apache.ofbiz.base.util.Debug;
> > >> import org.apache.ofbiz.base.util.GeneralException;
> > >> import org.apache.ofbiz.base.util.HttpClient;
> > >> import org.apache.ofbiz.base.util.HttpClientException;
> > >> import org.apache.ofbiz.base.util.UtilGenerics;
> > >> import org.apache.ofbiz.base.util.UtilMisc;
> > >> import org.apache.ofbiz.base.util.UtilProperties;
> > >> import org.apache.ofbiz.base.util.UtilValidate;
> > >> import org.apache.ofbiz.base.util.collections.MapStack;
> > >> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> > >> import org.apache.ofbiz.entity.Delegator;
> > >> import org.apache.ofbiz.entity.GenericValue;
> > >> import org.apache.ofbiz.entity.util.EntityUtilProperties;
> > >> import org.apache.ofbiz.service.DispatchContext;
> > >> import org.apache.ofbiz.service.GenericServiceException;
> > >> import org.apache.ofbiz.service.LocalDispatcher;
> > >> import org.apache.ofbiz.service.ServiceUtil;
> > >> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> > >> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> > >> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> > >> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> > >> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> > >> import org.xml.sax.SAXException;
> > >>
> > >> def testMail() {
> > >>          sendType = "mail.smtp.host"
> > >>          sendVia = "smtp.myhost.com"
> > >>          Properties props = System.getProperties()
> > >>      props.put(sendType, sendVia)
> > >>      Session session
> > >>      session = Session.getInstance(props);
> > >>      MimeMessage mail
> > >>      mail = new MimeMessage(session);
> > >>          Transport trans = null
> > >>          sendFrom = "obfiz.example.com"
> > >>          sendTo = "[hidden email]"
> > >>          subject = "testMail from OFBiz"
> > >>          mp = new MimeMultipart();
> > >>
> > >>          MimeBodyPart mbp = new MimeBodyPart();
> > >>          mbp.setText("Content: a test mail from OFBiz system")
> > >>
> > >>          mp.addBodyPart(mbp);
> > >>          mail.setContent(mp);
> > >>
> > >>          mail.setFrom(new InternetAddress(sendFrom));
> > >>          mail.setSubject(subject, "UTF-8");
> > >>          mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
> > >> Project");
> > >>          mail.setSentDate(new Date());
> > >>          mail.addRecipients(Message.RecipientType.TO, sendTo);
> > >>
> > >>          trans = session.getTransport("smtp")
> > >>          authUser =
> > UtilProperties.getPropertyValue('general.properties',
> > >> 'mail.smtp.auth.user')
> > >>          authPass =
> > UtilProperties.getPropertyValue('general.properties',
> > >> 'mail.smtp.auth.password')
> > >>
> > >>      trans.connect(sendVia, authUser, authPass);
> > >>          trans.sendMessage(mail, mail.getAllRecipients())
> > >>          trans.close()
> > >>
> > >>          logWarning("successful run of testMail ")
> > >>          logWarning(" user = " + userLogin.partyId);
> > >>
> > >>          return success("this test is done successful")
> > >> }
> > >>
> >
> >
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Pierre Smits-3
Hi Gil,

Does this maybe have something to do with recent migration by INFRA to have
ApacheIds (LDAP)+password being usable as login credentials? I can't edit
either.

Best regards,

Pierre Smits

*Apache Trafodion <https://trafodion.apache.org>, Vice President*
*Apache Directory <https://directory.apache.org>, PMC Member*
Apache Incubator <https://incubator.apache.org>, committer
*Apache OFBiz <https://ofbiz.apache.org>,  10 years a contributor without
privileges*
Apache Steve <https://steve.apache.org>, committer


On Tue, Mar 26, 2019 at 8:56 AM Gil Portenseigne <
[hidden email]> wrote:

> Hello there,
>
> Do somes actions have been taken on documenting the existence of
> SystemProperty ?
>
> I like the idea of migrating documentation into embedded one.
>
> I just wanted to add a note into https://s.apache.org/BPJ5 that alert
> about SystemProperty, but i seem to miss the modification permission...
> can someone grant me access ?
>
> Thanks
>
> Gil
>
>
> Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :
> > Actually, I think whatever need to be documented is best placed in our
> > embedded documentation. We should probably consider freezing all new
> > documentation in any place that is not the embedded documentation and try
> > to migrate everything to it. So email setting docs could be placed
> > somewhere in our user manual.
> >
> > On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <
> [hidden email]>
> > wrote:
> >
> > > Hi Rishi,
> > >
> > >
> > > Le 09/05/2018 ą 11:12, Rishi Solanki a écrit :
> > > > Community, I think we should mention the SystemProperty where
> required in
> > > > Production Setup Guide or may be we can add version of production
> setup
> > > > guide which will tells user upto which release this production setup
> > > guide
> > > > will work. I know we discuss this kind of effort in past for all the
> > > > documents and we agree on some point. But this is quicker to manage
> > > > Production Setup Guide, if we agree then I can do it.
> > > Yes good idea, a simple information for concerned versions in the
> current
> > > Production Setup Guide fits with me
> > >
> > > Jacques
> > > >
> > > > I'm fine with either change the existing one or maintain the
> version. But
> > > > first we should have one which works always with latest. Thanks!
> > > >
> > > >
> > > > Rishi Solanki
> > > > Sr Manager, Enterprise Software Development
> > > > HotWax Systems Pvt. Ltd.
> > > > Direct: +91-9893287847
> > > > http://www.hotwaxsystems.com
> > > > www.hotwax.co
> > > >
> > > > On Wed, May 9, 2018 at 3:33 AM, [hidden email] <
> [hidden email]>
> > > > wrote:
> > > >
> > > >> Hello,
> > > >>
> > > >> here is a problem with my e-mail base-configuration.
> > > >>
> > > >> I configured email according to the setup guide:
> > > >>
> > > >>
> > >
> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> > > >> Production+Setup+Guide#ApacheOFBizTechnicalProduction
> > > >> SetupGuide-EmailServerSettings
> > > >>
> > > >>
> > > >> Unfortunately no email seems to be sent from server
> > > >> (the send email button in partymgr works fine now (thanks to
> Jacques!),
> > > >> but no email reaches client). No error message, no error in log.
> > > >>
> > > >> Also I tried to register in the ecommerce system and send
> > > >> an "Forgot Your Password" email, but none of the emails were sent.
> > > >>
> > > >> To get more info about the problem, I wrote a groovy script and
> copied
> > > >> parts of the sendEmail-code from EmailServices.java.
> > > >> The script below surprisingly works fine and sends emails!
> > > >>
> > > >> So I don't understand, why OFBiz itself does not send mails.
> > > >> Is there any further configuration necessary?
> > > >>
> > > >>
> > > >>
> > > >> The script (which sends mails):
> > > >>
> > > >> import javax.mail.Session;
> > > >>
> > > >> import javax.activation.DataHandler;
> > > >> import javax.activation.DataSource;
> > > >> import javax.mail.Message;
> > > >> import javax.mail.MessagingException;
> > > >> import javax.mail.SendFailedException;
> > > >> import javax.mail.Session;
> > > >> import javax.mail.Transport;
> > > >> import javax.mail.internet.InternetAddress;
> > > >> import javax.mail.internet.MimeBodyPart;
> > > >> import javax.mail.internet.MimeMessage;
> > > >> import javax.mail.internet.MimeMultipart;
> > > >> import javax.xml.parsers.ParserConfigurationException;
> > > >> import javax.xml.transform.stream.StreamSource;
> > > >>
> > > >> import org.apache.fop.apps.Fop;
> > > >> import org.apache.fop.apps.MimeConstants;
> > > >> import org.apache.ofbiz.base.util.Debug;
> > > >> import org.apache.ofbiz.base.util.GeneralException;
> > > >> import org.apache.ofbiz.base.util.HttpClient;
> > > >> import org.apache.ofbiz.base.util.HttpClientException;
> > > >> import org.apache.ofbiz.base.util.UtilGenerics;
> > > >> import org.apache.ofbiz.base.util.UtilMisc;
> > > >> import org.apache.ofbiz.base.util.UtilProperties;
> > > >> import org.apache.ofbiz.base.util.UtilValidate;
> > > >> import org.apache.ofbiz.base.util.collections.MapStack;
> > > >> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> > > >> import org.apache.ofbiz.entity.Delegator;
> > > >> import org.apache.ofbiz.entity.GenericValue;
> > > >> import org.apache.ofbiz.entity.util.EntityUtilProperties;
> > > >> import org.apache.ofbiz.service.DispatchContext;
> > > >> import org.apache.ofbiz.service.GenericServiceException;
> > > >> import org.apache.ofbiz.service.LocalDispatcher;
> > > >> import org.apache.ofbiz.service.ServiceUtil;
> > > >> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> > > >> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> > > >> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> > > >> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> > > >> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> > > >> import org.xml.sax.SAXException;
> > > >>
> > > >> def testMail() {
> > > >>          sendType = "mail.smtp.host"
> > > >>          sendVia = "smtp.myhost.com"
> > > >>          Properties props = System.getProperties()
> > > >>      props.put(sendType, sendVia)
> > > >>      Session session
> > > >>      session = Session.getInstance(props);
> > > >>      MimeMessage mail
> > > >>      mail = new MimeMessage(session);
> > > >>          Transport trans = null
> > > >>          sendFrom = "obfiz.example.com"
> > > >>          sendTo = "[hidden email]"
> > > >>          subject = "testMail from OFBiz"
> > > >>          mp = new MimeMultipart();
> > > >>
> > > >>          MimeBodyPart mbp = new MimeBodyPart();
> > > >>          mbp.setText("Content: a test mail from OFBiz system")
> > > >>
> > > >>          mp.addBodyPart(mbp);
> > > >>          mail.setContent(mp);
> > > >>
> > > >>          mail.setFrom(new InternetAddress(sendFrom));
> > > >>          mail.setSubject(subject, "UTF-8");
> > > >>          mail.setHeader("X-Mailer", "Apache OFBiz, The Open For
> Business
> > > >> Project");
> > > >>          mail.setSentDate(new Date());
> > > >>          mail.addRecipients(Message.RecipientType.TO, sendTo);
> > > >>
> > > >>          trans = session.getTransport("smtp")
> > > >>          authUser =
> > > UtilProperties.getPropertyValue('general.properties',
> > > >> 'mail.smtp.auth.user')
> > > >>          authPass =
> > > UtilProperties.getPropertyValue('general.properties',
> > > >> 'mail.smtp.auth.password')
> > > >>
> > > >>      trans.connect(sendVia, authUser, authPass);
> > > >>          trans.sendMessage(mail, mail.getAllRecipients())
> > > >>          trans.close()
> > > >>
> > > >>          logWarning("successful run of testMail ")
> > > >>          logWarning(" user = " + userLogin.partyId);
> > > >>
> > > >>          return success("this test is done successful")
> > > >> }
> > > >>
> > >
> > >
>
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Jacques Le Roux
Administrator
In reply to this post by Gil Portenseigne
Hi Gil,

Let me check

Jacques

Le 26/03/2019 à 08:56, Gil Portenseigne a écrit :

> Hello there,
>
> Do somes actions have been taken on documenting the existence of
> SystemProperty ?
>
> I like the idea of migrating documentation into embedded one.
>
> I just wanted to add a note into https://s.apache.org/BPJ5 that alert
> about SystemProperty, but i seem to miss the modification permission...
> can someone grant me access ?
>
> Thanks
>
> Gil
>
>
> Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :
>> Actually, I think whatever need to be documented is best placed in our
>> embedded documentation. We should probably consider freezing all new
>> documentation in any place that is not the embedded documentation and try
>> to migrate everything to it. So email setting docs could be placed
>> somewhere in our user manual.
>>
>> On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <[hidden email]>
>> wrote:
>>
>>> Hi Rishi,
>>>
>>>
>>> Le 09/05/2018 à 11:12, Rishi Solanki a écrit :
>>>> Community, I think we should mention the SystemProperty where required in
>>>> Production Setup Guide or may be we can add version of production setup
>>>> guide which will tells user upto which release this production setup
>>> guide
>>>> will work. I know we discuss this kind of effort in past for all the
>>>> documents and we agree on some point. But this is quicker to manage
>>>> Production Setup Guide, if we agree then I can do it.
>>> Yes good idea, a simple information for concerned versions in the current
>>> Production Setup Guide fits with me
>>>
>>> Jacques
>>>> I'm fine with either change the existing one or maintain the version. But
>>>> first we should have one which works always with latest. Thanks!
>>>>
>>>>
>>>> Rishi Solanki
>>>> Sr Manager, Enterprise Software Development
>>>> HotWax Systems Pvt. Ltd.
>>>> Direct: +91-9893287847
>>>> http://www.hotwaxsystems.com
>>>> www.hotwax.co
>>>>
>>>> On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> here is a problem with my e-mail base-configuration.
>>>>>
>>>>> I configured email according to the setup guide:
>>>>>
>>>>>
>>> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
>>>>> Production+Setup+Guide#ApacheOFBizTechnicalProduction
>>>>> SetupGuide-EmailServerSettings
>>>>>
>>>>>
>>>>> Unfortunately no email seems to be sent from server
>>>>> (the send email button in partymgr works fine now (thanks to Jacques!),
>>>>> but no email reaches client). No error message, no error in log.
>>>>>
>>>>> Also I tried to register in the ecommerce system and send
>>>>> an "Forgot Your Password" email, but none of the emails were sent.
>>>>>
>>>>> To get more info about the problem, I wrote a groovy script and copied
>>>>> parts of the sendEmail-code from EmailServices.java.
>>>>> The script below surprisingly works fine and sends emails!
>>>>>
>>>>> So I don't understand, why OFBiz itself does not send mails.
>>>>> Is there any further configuration necessary?
>>>>>
>>>>>
>>>>>
>>>>> The script (which sends mails):
>>>>>
>>>>> import javax.mail.Session;
>>>>>
>>>>> import javax.activation.DataHandler;
>>>>> import javax.activation.DataSource;
>>>>> import javax.mail.Message;
>>>>> import javax.mail.MessagingException;
>>>>> import javax.mail.SendFailedException;
>>>>> import javax.mail.Session;
>>>>> import javax.mail.Transport;
>>>>> import javax.mail.internet.InternetAddress;
>>>>> import javax.mail.internet.MimeBodyPart;
>>>>> import javax.mail.internet.MimeMessage;
>>>>> import javax.mail.internet.MimeMultipart;
>>>>> import javax.xml.parsers.ParserConfigurationException;
>>>>> import javax.xml.transform.stream.StreamSource;
>>>>>
>>>>> import org.apache.fop.apps.Fop;
>>>>> import org.apache.fop.apps.MimeConstants;
>>>>> import org.apache.ofbiz.base.util.Debug;
>>>>> import org.apache.ofbiz.base.util.GeneralException;
>>>>> import org.apache.ofbiz.base.util.HttpClient;
>>>>> import org.apache.ofbiz.base.util.HttpClientException;
>>>>> import org.apache.ofbiz.base.util.UtilGenerics;
>>>>> import org.apache.ofbiz.base.util.UtilMisc;
>>>>> import org.apache.ofbiz.base.util.UtilProperties;
>>>>> import org.apache.ofbiz.base.util.UtilValidate;
>>>>> import org.apache.ofbiz.base.util.collections.MapStack;
>>>>> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
>>>>> import org.apache.ofbiz.entity.Delegator;
>>>>> import org.apache.ofbiz.entity.GenericValue;
>>>>> import org.apache.ofbiz.entity.util.EntityUtilProperties;
>>>>> import org.apache.ofbiz.service.DispatchContext;
>>>>> import org.apache.ofbiz.service.GenericServiceException;
>>>>> import org.apache.ofbiz.service.LocalDispatcher;
>>>>> import org.apache.ofbiz.service.ServiceUtil;
>>>>> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
>>>>> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
>>>>> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
>>>>> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
>>>>> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
>>>>> import org.xml.sax.SAXException;
>>>>>
>>>>> def testMail() {
>>>>>           sendType = "mail.smtp.host"
>>>>>           sendVia = "smtp.myhost.com"
>>>>>           Properties props = System.getProperties()
>>>>>       props.put(sendType, sendVia)
>>>>>       Session session
>>>>>       session = Session.getInstance(props);
>>>>>       MimeMessage mail
>>>>>       mail = new MimeMessage(session);
>>>>>           Transport trans = null
>>>>>           sendFrom = "obfiz.example.com"
>>>>>           sendTo = "[hidden email]"
>>>>>           subject = "testMail from OFBiz"
>>>>>           mp = new MimeMultipart();
>>>>>
>>>>>           MimeBodyPart mbp = new MimeBodyPart();
>>>>>           mbp.setText("Content: a test mail from OFBiz system")
>>>>>
>>>>>           mp.addBodyPart(mbp);
>>>>>           mail.setContent(mp);
>>>>>
>>>>>           mail.setFrom(new InternetAddress(sendFrom));
>>>>>           mail.setSubject(subject, "UTF-8");
>>>>>           mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
>>>>> Project");
>>>>>           mail.setSentDate(new Date());
>>>>>           mail.addRecipients(Message.RecipientType.TO, sendTo);
>>>>>
>>>>>           trans = session.getTransport("smtp")
>>>>>           authUser =
>>> UtilProperties.getPropertyValue('general.properties',
>>>>> 'mail.smtp.auth.user')
>>>>>           authPass =
>>> UtilProperties.getPropertyValue('general.properties',
>>>>> 'mail.smtp.auth.password')
>>>>>
>>>>>       trans.connect(sendVia, authUser, authPass);
>>>>>           trans.sendMessage(mail, mail.getAllRecipients())
>>>>>           trans.close()
>>>>>
>>>>>           logWarning("successful run of testMail ")
>>>>>           logWarning(" user = " + userLogin.partyId);
>>>>>
>>>>>           return success("this test is done successful")
>>>>> }
>>>>>
>>>
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Jacques Le Roux
Administrator
In reply to this post by Pierre Smits-3
Makes sense Pierre,

Please Gil checks https://issues.apache.org/jira/browse/INFRA-18028

HTH

Jacques

Le 26/03/2019 à 09:16, Pierre Smits a écrit :

> Hi Gil,
>
> Does this maybe have something to do with recent migration by INFRA to have
> ApacheIds (LDAP)+password being usable as login credentials? I can't edit
> either.
>
> Best regards,
>
> Pierre Smits
>
> *Apache Trafodion <https://trafodion.apache.org>, Vice President*
> *Apache Directory <https://directory.apache.org>, PMC Member*
> Apache Incubator <https://incubator.apache.org>, committer
> *Apache OFBiz <https://ofbiz.apache.org>,  10 years a contributor without
> privileges*
> Apache Steve <https://steve.apache.org>, committer
>
>
> On Tue, Mar 26, 2019 at 8:56 AM Gil Portenseigne <
> [hidden email]> wrote:
>
>> Hello there,
>>
>> Do somes actions have been taken on documenting the existence of
>> SystemProperty ?
>>
>> I like the idea of migrating documentation into embedded one.
>>
>> I just wanted to add a note into https://s.apache.org/BPJ5 that alert
>> about SystemProperty, but i seem to miss the modification permission...
>> can someone grant me access ?
>>
>> Thanks
>>
>> Gil
>>
>>
>> Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :
>>> Actually, I think whatever need to be documented is best placed in our
>>> embedded documentation. We should probably consider freezing all new
>>> documentation in any place that is not the embedded documentation and try
>>> to migrate everything to it. So email setting docs could be placed
>>> somewhere in our user manual.
>>>
>>> On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <
>> [hidden email]>
>>> wrote:
>>>
>>>> Hi Rishi,
>>>>
>>>>
>>>> Le 09/05/2018 ą 11:12, Rishi Solanki a écrit :
>>>>> Community, I think we should mention the SystemProperty where
>> required in
>>>>> Production Setup Guide or may be we can add version of production
>> setup
>>>>> guide which will tells user upto which release this production setup
>>>> guide
>>>>> will work. I know we discuss this kind of effort in past for all the
>>>>> documents and we agree on some point. But this is quicker to manage
>>>>> Production Setup Guide, if we agree then I can do it.
>>>> Yes good idea, a simple information for concerned versions in the
>> current
>>>> Production Setup Guide fits with me
>>>>
>>>> Jacques
>>>>> I'm fine with either change the existing one or maintain the
>> version. But
>>>>> first we should have one which works always with latest. Thanks!
>>>>>
>>>>>
>>>>> Rishi Solanki
>>>>> Sr Manager, Enterprise Software Development
>>>>> HotWax Systems Pvt. Ltd.
>>>>> Direct: +91-9893287847
>>>>> http://www.hotwaxsystems.com
>>>>> www.hotwax.co
>>>>>
>>>>> On Wed, May 9, 2018 at 3:33 AM, [hidden email] <
>> [hidden email]>
>>>>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> here is a problem with my e-mail base-configuration.
>>>>>>
>>>>>> I configured email according to the setup guide:
>>>>>>
>>>>>>
>> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
>>>>>> Production+Setup+Guide#ApacheOFBizTechnicalProduction
>>>>>> SetupGuide-EmailServerSettings
>>>>>>
>>>>>>
>>>>>> Unfortunately no email seems to be sent from server
>>>>>> (the send email button in partymgr works fine now (thanks to
>> Jacques!),
>>>>>> but no email reaches client). No error message, no error in log.
>>>>>>
>>>>>> Also I tried to register in the ecommerce system and send
>>>>>> an "Forgot Your Password" email, but none of the emails were sent.
>>>>>>
>>>>>> To get more info about the problem, I wrote a groovy script and
>> copied
>>>>>> parts of the sendEmail-code from EmailServices.java.
>>>>>> The script below surprisingly works fine and sends emails!
>>>>>>
>>>>>> So I don't understand, why OFBiz itself does not send mails.
>>>>>> Is there any further configuration necessary?
>>>>>>
>>>>>>
>>>>>>
>>>>>> The script (which sends mails):
>>>>>>
>>>>>> import javax.mail.Session;
>>>>>>
>>>>>> import javax.activation.DataHandler;
>>>>>> import javax.activation.DataSource;
>>>>>> import javax.mail.Message;
>>>>>> import javax.mail.MessagingException;
>>>>>> import javax.mail.SendFailedException;
>>>>>> import javax.mail.Session;
>>>>>> import javax.mail.Transport;
>>>>>> import javax.mail.internet.InternetAddress;
>>>>>> import javax.mail.internet.MimeBodyPart;
>>>>>> import javax.mail.internet.MimeMessage;
>>>>>> import javax.mail.internet.MimeMultipart;
>>>>>> import javax.xml.parsers.ParserConfigurationException;
>>>>>> import javax.xml.transform.stream.StreamSource;
>>>>>>
>>>>>> import org.apache.fop.apps.Fop;
>>>>>> import org.apache.fop.apps.MimeConstants;
>>>>>> import org.apache.ofbiz.base.util.Debug;
>>>>>> import org.apache.ofbiz.base.util.GeneralException;
>>>>>> import org.apache.ofbiz.base.util.HttpClient;
>>>>>> import org.apache.ofbiz.base.util.HttpClientException;
>>>>>> import org.apache.ofbiz.base.util.UtilGenerics;
>>>>>> import org.apache.ofbiz.base.util.UtilMisc;
>>>>>> import org.apache.ofbiz.base.util.UtilProperties;
>>>>>> import org.apache.ofbiz.base.util.UtilValidate;
>>>>>> import org.apache.ofbiz.base.util.collections.MapStack;
>>>>>> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
>>>>>> import org.apache.ofbiz.entity.Delegator;
>>>>>> import org.apache.ofbiz.entity.GenericValue;
>>>>>> import org.apache.ofbiz.entity.util.EntityUtilProperties;
>>>>>> import org.apache.ofbiz.service.DispatchContext;
>>>>>> import org.apache.ofbiz.service.GenericServiceException;
>>>>>> import org.apache.ofbiz.service.LocalDispatcher;
>>>>>> import org.apache.ofbiz.service.ServiceUtil;
>>>>>> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
>>>>>> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
>>>>>> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
>>>>>> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
>>>>>> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
>>>>>> import org.xml.sax.SAXException;
>>>>>>
>>>>>> def testMail() {
>>>>>>           sendType = "mail.smtp.host"
>>>>>>           sendVia = "smtp.myhost.com"
>>>>>>           Properties props = System.getProperties()
>>>>>>       props.put(sendType, sendVia)
>>>>>>       Session session
>>>>>>       session = Session.getInstance(props);
>>>>>>       MimeMessage mail
>>>>>>       mail = new MimeMessage(session);
>>>>>>           Transport trans = null
>>>>>>           sendFrom = "obfiz.example.com"
>>>>>>           sendTo = "[hidden email]"
>>>>>>           subject = "testMail from OFBiz"
>>>>>>           mp = new MimeMultipart();
>>>>>>
>>>>>>           MimeBodyPart mbp = new MimeBodyPart();
>>>>>>           mbp.setText("Content: a test mail from OFBiz system")
>>>>>>
>>>>>>           mp.addBodyPart(mbp);
>>>>>>           mail.setContent(mp);
>>>>>>
>>>>>>           mail.setFrom(new InternetAddress(sendFrom));
>>>>>>           mail.setSubject(subject, "UTF-8");
>>>>>>           mail.setHeader("X-Mailer", "Apache OFBiz, The Open For
>> Business
>>>>>> Project");
>>>>>>           mail.setSentDate(new Date());
>>>>>>           mail.addRecipients(Message.RecipientType.TO, sendTo);
>>>>>>
>>>>>>           trans = session.getTransport("smtp")
>>>>>>           authUser =
>>>> UtilProperties.getPropertyValue('general.properties',
>>>>>> 'mail.smtp.auth.user')
>>>>>>           authPass =
>>>> UtilProperties.getPropertyValue('general.properties',
>>>>>> 'mail.smtp.auth.password')
>>>>>>
>>>>>>       trans.connect(sendVia, authUser, authPass);
>>>>>>           trans.sendMessage(mail, mail.getAllRecipients())
>>>>>>           trans.close()
>>>>>>
>>>>>>           logWarning("successful run of testMail ")
>>>>>>           logWarning(" user = " + userLogin.partyId);
>>>>>>
>>>>>>           return success("this test is done successful")
>>>>>> }
>>>>>>
>>>>
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Gil Portenseigne
In reply to this post by Jacques Le Roux
Thanks Jacques :)


Le 09:21 - mardi 26 mars, Jacques Le Roux a écrit :

> Hi Gil,
>
> Let me check
>
> Jacques
>
> Le 26/03/2019 à 08:56, Gil Portenseigne a écrit :
> > Hello there,
> >
> > Do somes actions have been taken on documenting the existence of
> > SystemProperty ?
> >
> > I like the idea of migrating documentation into embedded one.
> >
> > I just wanted to add a note into https://s.apache.org/BPJ5 that alert
> > about SystemProperty, but i seem to miss the modification permission...
> > can someone grant me access ?
> >
> > Thanks
> >
> > Gil
> >
> >
> > Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :
> > > Actually, I think whatever need to be documented is best placed in our
> > > embedded documentation. We should probably consider freezing all new
> > > documentation in any place that is not the embedded documentation and try
> > > to migrate everything to it. So email setting docs could be placed
> > > somewhere in our user manual.
> > >
> > > On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <[hidden email]>
> > > wrote:
> > >
> > > > Hi Rishi,
> > > >
> > > >
> > > > Le 09/05/2018 à 11:12, Rishi Solanki a écrit :
> > > > > Community, I think we should mention the SystemProperty where required in
> > > > > Production Setup Guide or may be we can add version of production setup
> > > > > guide which will tells user upto which release this production setup
> > > > guide
> > > > > will work. I know we discuss this kind of effort in past for all the
> > > > > documents and we agree on some point. But this is quicker to manage
> > > > > Production Setup Guide, if we agree then I can do it.
> > > > Yes good idea, a simple information for concerned versions in the current
> > > > Production Setup Guide fits with me
> > > >
> > > > Jacques
> > > > > I'm fine with either change the existing one or maintain the version. But
> > > > > first we should have one which works always with latest. Thanks!
> > > > >
> > > > >
> > > > > Rishi Solanki
> > > > > Sr Manager, Enterprise Software Development
> > > > > HotWax Systems Pvt. Ltd.
> > > > > Direct: +91-9893287847
> > > > > http://www.hotwaxsystems.com
> > > > > www.hotwax.co
> > > > >
> > > > > On Wed, May 9, 2018 at 3:33 AM, [hidden email] <[hidden email]>
> > > > > wrote:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > here is a problem with my e-mail base-configuration.
> > > > > >
> > > > > > I configured email according to the setup guide:
> > > > > >
> > > > > >
> > > > https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> > > > > > Production+Setup+Guide#ApacheOFBizTechnicalProduction
> > > > > > SetupGuide-EmailServerSettings
> > > > > >
> > > > > >
> > > > > > Unfortunately no email seems to be sent from server
> > > > > > (the send email button in partymgr works fine now (thanks to Jacques!),
> > > > > > but no email reaches client). No error message, no error in log.
> > > > > >
> > > > > > Also I tried to register in the ecommerce system and send
> > > > > > an "Forgot Your Password" email, but none of the emails were sent.
> > > > > >
> > > > > > To get more info about the problem, I wrote a groovy script and copied
> > > > > > parts of the sendEmail-code from EmailServices.java.
> > > > > > The script below surprisingly works fine and sends emails!
> > > > > >
> > > > > > So I don't understand, why OFBiz itself does not send mails.
> > > > > > Is there any further configuration necessary?
> > > > > >
> > > > > >
> > > > > >
> > > > > > The script (which sends mails):
> > > > > >
> > > > > > import javax.mail.Session;
> > > > > >
> > > > > > import javax.activation.DataHandler;
> > > > > > import javax.activation.DataSource;
> > > > > > import javax.mail.Message;
> > > > > > import javax.mail.MessagingException;
> > > > > > import javax.mail.SendFailedException;
> > > > > > import javax.mail.Session;
> > > > > > import javax.mail.Transport;
> > > > > > import javax.mail.internet.InternetAddress;
> > > > > > import javax.mail.internet.MimeBodyPart;
> > > > > > import javax.mail.internet.MimeMessage;
> > > > > > import javax.mail.internet.MimeMultipart;
> > > > > > import javax.xml.parsers.ParserConfigurationException;
> > > > > > import javax.xml.transform.stream.StreamSource;
> > > > > >
> > > > > > import org.apache.fop.apps.Fop;
> > > > > > import org.apache.fop.apps.MimeConstants;
> > > > > > import org.apache.ofbiz.base.util.Debug;
> > > > > > import org.apache.ofbiz.base.util.GeneralException;
> > > > > > import org.apache.ofbiz.base.util.HttpClient;
> > > > > > import org.apache.ofbiz.base.util.HttpClientException;
> > > > > > import org.apache.ofbiz.base.util.UtilGenerics;
> > > > > > import org.apache.ofbiz.base.util.UtilMisc;
> > > > > > import org.apache.ofbiz.base.util.UtilProperties;
> > > > > > import org.apache.ofbiz.base.util.UtilValidate;
> > > > > > import org.apache.ofbiz.base.util.collections.MapStack;
> > > > > > import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> > > > > > import org.apache.ofbiz.entity.Delegator;
> > > > > > import org.apache.ofbiz.entity.GenericValue;
> > > > > > import org.apache.ofbiz.entity.util.EntityUtilProperties;
> > > > > > import org.apache.ofbiz.service.DispatchContext;
> > > > > > import org.apache.ofbiz.service.GenericServiceException;
> > > > > > import org.apache.ofbiz.service.LocalDispatcher;
> > > > > > import org.apache.ofbiz.service.ServiceUtil;
> > > > > > import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> > > > > > import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> > > > > > import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> > > > > > import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> > > > > > import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> > > > > > import org.xml.sax.SAXException;
> > > > > >
> > > > > > def testMail() {
> > > > > >           sendType = "mail.smtp.host"
> > > > > >           sendVia = "smtp.myhost.com"
> > > > > >           Properties props = System.getProperties()
> > > > > >       props.put(sendType, sendVia)
> > > > > >       Session session
> > > > > >       session = Session.getInstance(props);
> > > > > >       MimeMessage mail
> > > > > >       mail = new MimeMessage(session);
> > > > > >           Transport trans = null
> > > > > >           sendFrom = "obfiz.example.com"
> > > > > >           sendTo = "[hidden email]"
> > > > > >           subject = "testMail from OFBiz"
> > > > > >           mp = new MimeMultipart();
> > > > > >
> > > > > >           MimeBodyPart mbp = new MimeBodyPart();
> > > > > >           mbp.setText("Content: a test mail from OFBiz system")
> > > > > >
> > > > > >           mp.addBodyPart(mbp);
> > > > > >           mail.setContent(mp);
> > > > > >
> > > > > >           mail.setFrom(new InternetAddress(sendFrom));
> > > > > >           mail.setSubject(subject, "UTF-8");
> > > > > >           mail.setHeader("X-Mailer", "Apache OFBiz, The Open For Business
> > > > > > Project");
> > > > > >           mail.setSentDate(new Date());
> > > > > >           mail.addRecipients(Message.RecipientType.TO, sendTo);
> > > > > >
> > > > > >           trans = session.getTransport("smtp")
> > > > > >           authUser =
> > > > UtilProperties.getPropertyValue('general.properties',
> > > > > > 'mail.smtp.auth.user')
> > > > > >           authPass =
> > > > UtilProperties.getPropertyValue('general.properties',
> > > > > > 'mail.smtp.auth.password')
> > > > > >
> > > > > >       trans.connect(sendVia, authUser, authPass);
> > > > > >           trans.sendMessage(mail, mail.getAllRecipients())
> > > > > >           trans.close()
> > > > > >
> > > > > >           logWarning("successful run of testMail ")
> > > > > >           logWarning(" user = " + userLogin.partyId);
> > > > > >
> > > > > >           return success("this test is done successful")
> > > > > > }
> > > > > >
> > > >
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Gil Portenseigne
In reply to this post by Jacques Le Roux
What I understand is that to keep granted right after the migration if
our confluence id is différent from our apache id, we must fill in a
INFRA Jira to make the switch ?


Le 09:23 - mardi 26 mars, Jacques Le Roux a écrit :

> Makes sense Pierre,
>
> Please Gil checks https://issues.apache.org/jira/browse/INFRA-18028
>
> HTH
>
> Jacques
>
> Le 26/03/2019 à 09:16, Pierre Smits a écrit :
> > Hi Gil,
> >
> > Does this maybe have something to do with recent migration by INFRA to have
> > ApacheIds (LDAP)+password being usable as login credentials? I can't edit
> > either.
> >
> > Best regards,
> >
> > Pierre Smits
> >
> > *Apache Trafodion <https://trafodion.apache.org>, Vice President*
> > *Apache Directory <https://directory.apache.org>, PMC Member*
> > Apache Incubator <https://incubator.apache.org>, committer
> > *Apache OFBiz <https://ofbiz.apache.org>,  10 years a contributor without
> > privileges*
> > Apache Steve <https://steve.apache.org>, committer
> >
> >
> > On Tue, Mar 26, 2019 at 8:56 AM Gil Portenseigne <
> > [hidden email]> wrote:
> >
> > > Hello there,
> > >
> > > Do somes actions have been taken on documenting the existence of
> > > SystemProperty ?
> > >
> > > I like the idea of migrating documentation into embedded one.
> > >
> > > I just wanted to add a note into https://s.apache.org/BPJ5 that alert
> > > about SystemProperty, but i seem to miss the modification permission...
> > > can someone grant me access ?
> > >
> > > Thanks
> > >
> > > Gil
> > >
> > >
> > > Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :
> > > > Actually, I think whatever need to be documented is best placed in our
> > > > embedded documentation. We should probably consider freezing all new
> > > > documentation in any place that is not the embedded documentation and try
> > > > to migrate everything to it. So email setting docs could be placed
> > > > somewhere in our user manual.
> > > >
> > > > On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <
> > > [hidden email]>
> > > > wrote:
> > > >
> > > > > Hi Rishi,
> > > > >
> > > > >
> > > > > Le 09/05/2018 ą 11:12, Rishi Solanki a écrit :
> > > > > > Community, I think we should mention the SystemProperty where
> > > required in
> > > > > > Production Setup Guide or may be we can add version of production
> > > setup
> > > > > > guide which will tells user upto which release this production setup
> > > > > guide
> > > > > > will work. I know we discuss this kind of effort in past for all the
> > > > > > documents and we agree on some point. But this is quicker to manage
> > > > > > Production Setup Guide, if we agree then I can do it.
> > > > > Yes good idea, a simple information for concerned versions in the
> > > current
> > > > > Production Setup Guide fits with me
> > > > >
> > > > > Jacques
> > > > > > I'm fine with either change the existing one or maintain the
> > > version. But
> > > > > > first we should have one which works always with latest. Thanks!
> > > > > >
> > > > > >
> > > > > > Rishi Solanki
> > > > > > Sr Manager, Enterprise Software Development
> > > > > > HotWax Systems Pvt. Ltd.
> > > > > > Direct: +91-9893287847
> > > > > > http://www.hotwaxsystems.com
> > > > > > www.hotwax.co
> > > > > >
> > > > > > On Wed, May 9, 2018 at 3:33 AM, [hidden email] <
> > > [hidden email]>
> > > > > > wrote:
> > > > > >
> > > > > > > Hello,
> > > > > > >
> > > > > > > here is a problem with my e-mail base-configuration.
> > > > > > >
> > > > > > > I configured email according to the setup guide:
> > > > > > >
> > > > > > >
> > > https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> > > > > > > Production+Setup+Guide#ApacheOFBizTechnicalProduction
> > > > > > > SetupGuide-EmailServerSettings
> > > > > > >
> > > > > > >
> > > > > > > Unfortunately no email seems to be sent from server
> > > > > > > (the send email button in partymgr works fine now (thanks to
> > > Jacques!),
> > > > > > > but no email reaches client). No error message, no error in log.
> > > > > > >
> > > > > > > Also I tried to register in the ecommerce system and send
> > > > > > > an "Forgot Your Password" email, but none of the emails were sent.
> > > > > > >
> > > > > > > To get more info about the problem, I wrote a groovy script and
> > > copied
> > > > > > > parts of the sendEmail-code from EmailServices.java.
> > > > > > > The script below surprisingly works fine and sends emails!
> > > > > > >
> > > > > > > So I don't understand, why OFBiz itself does not send mails.
> > > > > > > Is there any further configuration necessary?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > The script (which sends mails):
> > > > > > >
> > > > > > > import javax.mail.Session;
> > > > > > >
> > > > > > > import javax.activation.DataHandler;
> > > > > > > import javax.activation.DataSource;
> > > > > > > import javax.mail.Message;
> > > > > > > import javax.mail.MessagingException;
> > > > > > > import javax.mail.SendFailedException;
> > > > > > > import javax.mail.Session;
> > > > > > > import javax.mail.Transport;
> > > > > > > import javax.mail.internet.InternetAddress;
> > > > > > > import javax.mail.internet.MimeBodyPart;
> > > > > > > import javax.mail.internet.MimeMessage;
> > > > > > > import javax.mail.internet.MimeMultipart;
> > > > > > > import javax.xml.parsers.ParserConfigurationException;
> > > > > > > import javax.xml.transform.stream.StreamSource;
> > > > > > >
> > > > > > > import org.apache.fop.apps.Fop;
> > > > > > > import org.apache.fop.apps.MimeConstants;
> > > > > > > import org.apache.ofbiz.base.util.Debug;
> > > > > > > import org.apache.ofbiz.base.util.GeneralException;
> > > > > > > import org.apache.ofbiz.base.util.HttpClient;
> > > > > > > import org.apache.ofbiz.base.util.HttpClientException;
> > > > > > > import org.apache.ofbiz.base.util.UtilGenerics;
> > > > > > > import org.apache.ofbiz.base.util.UtilMisc;
> > > > > > > import org.apache.ofbiz.base.util.UtilProperties;
> > > > > > > import org.apache.ofbiz.base.util.UtilValidate;
> > > > > > > import org.apache.ofbiz.base.util.collections.MapStack;
> > > > > > > import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
> > > > > > > import org.apache.ofbiz.entity.Delegator;
> > > > > > > import org.apache.ofbiz.entity.GenericValue;
> > > > > > > import org.apache.ofbiz.entity.util.EntityUtilProperties;
> > > > > > > import org.apache.ofbiz.service.DispatchContext;
> > > > > > > import org.apache.ofbiz.service.GenericServiceException;
> > > > > > > import org.apache.ofbiz.service.LocalDispatcher;
> > > > > > > import org.apache.ofbiz.service.ServiceUtil;
> > > > > > > import org.apache.ofbiz.service.mail.MimeMessageWrapper;
> > > > > > > import org.apache.ofbiz.webapp.view.ApacheFopWorker;
> > > > > > > import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
> > > > > > > import org.apache.ofbiz.widget.renderer.ScreenRenderer;
> > > > > > > import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
> > > > > > > import org.xml.sax.SAXException;
> > > > > > >
> > > > > > > def testMail() {
> > > > > > >           sendType = "mail.smtp.host"
> > > > > > >           sendVia = "smtp.myhost.com"
> > > > > > >           Properties props = System.getProperties()
> > > > > > >       props.put(sendType, sendVia)
> > > > > > >       Session session
> > > > > > >       session = Session.getInstance(props);
> > > > > > >       MimeMessage mail
> > > > > > >       mail = new MimeMessage(session);
> > > > > > >           Transport trans = null
> > > > > > >           sendFrom = "obfiz.example.com"
> > > > > > >           sendTo = "[hidden email]"
> > > > > > >           subject = "testMail from OFBiz"
> > > > > > >           mp = new MimeMultipart();
> > > > > > >
> > > > > > >           MimeBodyPart mbp = new MimeBodyPart();
> > > > > > >           mbp.setText("Content: a test mail from OFBiz system")
> > > > > > >
> > > > > > >           mp.addBodyPart(mbp);
> > > > > > >           mail.setContent(mp);
> > > > > > >
> > > > > > >           mail.setFrom(new InternetAddress(sendFrom));
> > > > > > >           mail.setSubject(subject, "UTF-8");
> > > > > > >           mail.setHeader("X-Mailer", "Apache OFBiz, The Open For
> > > Business
> > > > > > > Project");
> > > > > > >           mail.setSentDate(new Date());
> > > > > > >           mail.addRecipients(Message.RecipientType.TO, sendTo);
> > > > > > >
> > > > > > >           trans = session.getTransport("smtp")
> > > > > > >           authUser =
> > > > > UtilProperties.getPropertyValue('general.properties',
> > > > > > > 'mail.smtp.auth.user')
> > > > > > >           authPass =
> > > > > UtilProperties.getPropertyValue('general.properties',
> > > > > > > 'mail.smtp.auth.password')
> > > > > > >
> > > > > > >       trans.connect(sendVia, authUser, authPass);
> > > > > > >           trans.sendMessage(mail, mail.getAllRecipients())
> > > > > > >           trans.close()
> > > > > > >
> > > > > > >           logWarning("successful run of testMail ")
> > > > > > >           logWarning(" user = " + userLogin.partyId);
> > > > > > >
> > > > > > >           return success("this test is done successful")
> > > > > > > }
> > > > > > >
> > > > >
Reply | Threaded
Open this post in threaded view
|

Re: Send E-Mails

Jacques Le Roux
Administrator
Yep

Jacques

Le 26/03/2019 à 09:37, Gil Portenseigne a écrit :

> What I understand is that to keep granted right after the migration if
> our confluence id is différent from our apache id, we must fill in a
> INFRA Jira to make the switch ?
>
>
> Le 09:23 - mardi 26 mars, Jacques Le Roux a écrit :
>> Makes sense Pierre,
>>
>> Please Gil checks https://issues.apache.org/jira/browse/INFRA-18028
>>
>> HTH
>>
>> Jacques
>>
>> Le 26/03/2019 à 09:16, Pierre Smits a écrit :
>>> Hi Gil,
>>>
>>> Does this maybe have something to do with recent migration by INFRA to have
>>> ApacheIds (LDAP)+password being usable as login credentials? I can't edit
>>> either.
>>>
>>> Best regards,
>>>
>>> Pierre Smits
>>>
>>> *Apache Trafodion <https://trafodion.apache.org>, Vice President*
>>> *Apache Directory <https://directory.apache.org>, PMC Member*
>>> Apache Incubator <https://incubator.apache.org>, committer
>>> *Apache OFBiz <https://ofbiz.apache.org>,  10 years a contributor without
>>> privileges*
>>> Apache Steve <https://steve.apache.org>, committer
>>>
>>>
>>> On Tue, Mar 26, 2019 at 8:56 AM Gil Portenseigne <
>>> [hidden email]> wrote:
>>>
>>>> Hello there,
>>>>
>>>> Do somes actions have been taken on documenting the existence of
>>>> SystemProperty ?
>>>>
>>>> I like the idea of migrating documentation into embedded one.
>>>>
>>>> I just wanted to add a note into https://s.apache.org/BPJ5 that alert
>>>> about SystemProperty, but i seem to miss the modification permission...
>>>> can someone grant me access ?
>>>>
>>>> Thanks
>>>>
>>>> Gil
>>>>
>>>>
>>>> Le 12:50 - vendredi 11 mai, Taher Alkhateeb a écrit :
>>>>> Actually, I think whatever need to be documented is best placed in our
>>>>> embedded documentation. We should probably consider freezing all new
>>>>> documentation in any place that is not the embedded documentation and try
>>>>> to migrate everything to it. So email setting docs could be placed
>>>>> somewhere in our user manual.
>>>>>
>>>>> On Fri, May 11, 2018, 11:51 AM Jacques Le Roux <
>>>> [hidden email]>
>>>>> wrote:
>>>>>
>>>>>> Hi Rishi,
>>>>>>
>>>>>>
>>>>>> Le 09/05/2018 ą 11:12, Rishi Solanki a écrit :
>>>>>>> Community, I think we should mention the SystemProperty where
>>>> required in
>>>>>>> Production Setup Guide or may be we can add version of production
>>>> setup
>>>>>>> guide which will tells user upto which release this production setup
>>>>>> guide
>>>>>>> will work. I know we discuss this kind of effort in past for all the
>>>>>>> documents and we agree on some point. But this is quicker to manage
>>>>>>> Production Setup Guide, if we agree then I can do it.
>>>>>> Yes good idea, a simple information for concerned versions in the
>>>> current
>>>>>> Production Setup Guide fits with me
>>>>>>
>>>>>> Jacques
>>>>>>> I'm fine with either change the existing one or maintain the
>>>> version. But
>>>>>>> first we should have one which works always with latest. Thanks!
>>>>>>>
>>>>>>>
>>>>>>> Rishi Solanki
>>>>>>> Sr Manager, Enterprise Software Development
>>>>>>> HotWax Systems Pvt. Ltd.
>>>>>>> Direct: +91-9893287847
>>>>>>> http://www.hotwaxsystems.com
>>>>>>> www.hotwax.co
>>>>>>>
>>>>>>> On Wed, May 9, 2018 at 3:33 AM, [hidden email] <
>>>> [hidden email]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> here is a problem with my e-mail base-configuration.
>>>>>>>>
>>>>>>>> I configured email according to the setup guide:
>>>>>>>>
>>>>>>>>
>>>> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
>>>>>>>> Production+Setup+Guide#ApacheOFBizTechnicalProduction
>>>>>>>> SetupGuide-EmailServerSettings
>>>>>>>>
>>>>>>>>
>>>>>>>> Unfortunately no email seems to be sent from server
>>>>>>>> (the send email button in partymgr works fine now (thanks to
>>>> Jacques!),
>>>>>>>> but no email reaches client). No error message, no error in log.
>>>>>>>>
>>>>>>>> Also I tried to register in the ecommerce system and send
>>>>>>>> an "Forgot Your Password" email, but none of the emails were sent.
>>>>>>>>
>>>>>>>> To get more info about the problem, I wrote a groovy script and
>>>> copied
>>>>>>>> parts of the sendEmail-code from EmailServices.java.
>>>>>>>> The script below surprisingly works fine and sends emails!
>>>>>>>>
>>>>>>>> So I don't understand, why OFBiz itself does not send mails.
>>>>>>>> Is there any further configuration necessary?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> The script (which sends mails):
>>>>>>>>
>>>>>>>> import javax.mail.Session;
>>>>>>>>
>>>>>>>> import javax.activation.DataHandler;
>>>>>>>> import javax.activation.DataSource;
>>>>>>>> import javax.mail.Message;
>>>>>>>> import javax.mail.MessagingException;
>>>>>>>> import javax.mail.SendFailedException;
>>>>>>>> import javax.mail.Session;
>>>>>>>> import javax.mail.Transport;
>>>>>>>> import javax.mail.internet.InternetAddress;
>>>>>>>> import javax.mail.internet.MimeBodyPart;
>>>>>>>> import javax.mail.internet.MimeMessage;
>>>>>>>> import javax.mail.internet.MimeMultipart;
>>>>>>>> import javax.xml.parsers.ParserConfigurationException;
>>>>>>>> import javax.xml.transform.stream.StreamSource;
>>>>>>>>
>>>>>>>> import org.apache.fop.apps.Fop;
>>>>>>>> import org.apache.fop.apps.MimeConstants;
>>>>>>>> import org.apache.ofbiz.base.util.Debug;
>>>>>>>> import org.apache.ofbiz.base.util.GeneralException;
>>>>>>>> import org.apache.ofbiz.base.util.HttpClient;
>>>>>>>> import org.apache.ofbiz.base.util.HttpClientException;
>>>>>>>> import org.apache.ofbiz.base.util.UtilGenerics;
>>>>>>>> import org.apache.ofbiz.base.util.UtilMisc;
>>>>>>>> import org.apache.ofbiz.base.util.UtilProperties;
>>>>>>>> import org.apache.ofbiz.base.util.UtilValidate;
>>>>>>>> import org.apache.ofbiz.base.util.collections.MapStack;
>>>>>>>> import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
>>>>>>>> import org.apache.ofbiz.entity.Delegator;
>>>>>>>> import org.apache.ofbiz.entity.GenericValue;
>>>>>>>> import org.apache.ofbiz.entity.util.EntityUtilProperties;
>>>>>>>> import org.apache.ofbiz.service.DispatchContext;
>>>>>>>> import org.apache.ofbiz.service.GenericServiceException;
>>>>>>>> import org.apache.ofbiz.service.LocalDispatcher;
>>>>>>>> import org.apache.ofbiz.service.ServiceUtil;
>>>>>>>> import org.apache.ofbiz.service.mail.MimeMessageWrapper;
>>>>>>>> import org.apache.ofbiz.webapp.view.ApacheFopWorker;
>>>>>>>> import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
>>>>>>>> import org.apache.ofbiz.widget.renderer.ScreenRenderer;
>>>>>>>> import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
>>>>>>>> import org.xml.sax.SAXException;
>>>>>>>>
>>>>>>>> def testMail() {
>>>>>>>>            sendType = "mail.smtp.host"
>>>>>>>>            sendVia = "smtp.myhost.com"
>>>>>>>>            Properties props = System.getProperties()
>>>>>>>>        props.put(sendType, sendVia)
>>>>>>>>        Session session
>>>>>>>>        session = Session.getInstance(props);
>>>>>>>>        MimeMessage mail
>>>>>>>>        mail = new MimeMessage(session);
>>>>>>>>            Transport trans = null
>>>>>>>>            sendFrom = "obfiz.example.com"
>>>>>>>>            sendTo = "[hidden email]"
>>>>>>>>            subject = "testMail from OFBiz"
>>>>>>>>            mp = new MimeMultipart();
>>>>>>>>
>>>>>>>>            MimeBodyPart mbp = new MimeBodyPart();
>>>>>>>>            mbp.setText("Content: a test mail from OFBiz system")
>>>>>>>>
>>>>>>>>            mp.addBodyPart(mbp);
>>>>>>>>            mail.setContent(mp);
>>>>>>>>
>>>>>>>>            mail.setFrom(new InternetAddress(sendFrom));
>>>>>>>>            mail.setSubject(subject, "UTF-8");
>>>>>>>>            mail.setHeader("X-Mailer", "Apache OFBiz, The Open For
>>>> Business
>>>>>>>> Project");
>>>>>>>>            mail.setSentDate(new Date());
>>>>>>>>            mail.addRecipients(Message.RecipientType.TO, sendTo);
>>>>>>>>
>>>>>>>>            trans = session.getTransport("smtp")
>>>>>>>>            authUser =
>>>>>> UtilProperties.getPropertyValue('general.properties',
>>>>>>>> 'mail.smtp.auth.user')
>>>>>>>>            authPass =
>>>>>> UtilProperties.getPropertyValue('general.properties',
>>>>>>>> 'mail.smtp.auth.password')
>>>>>>>>
>>>>>>>>        trans.connect(sendVia, authUser, authPass);
>>>>>>>>            trans.sendMessage(mail, mail.getAllRecipients())
>>>>>>>>            trans.close()
>>>>>>>>
>>>>>>>>            logWarning("successful run of testMail ")
>>>>>>>>            logWarning(" user = " + userLogin.partyId);
>>>>>>>>
>>>>>>>>            return success("this test is done successful")
>>>>>>>> }
>>>>>>>>