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, [email protected] 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 = "[email protected]"
        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 via email to