0

I have added this in my pom.xml . I am on windows7 , I am using java+testng to write automation scripts. Do I need postfix smtp server to send emails, thats why below code is not running for me, because same code is running on ubuntu machine, which has postfix installed.

 <plugin>
            <groupId>ch.fortysix</groupId>
            <artifactId>maven-postman-plugin</artifactId>
            <executions>
                <execution>
                    <id>send a mail</id>
                    <phase>test</phase>
                    <goals>
                        <goal>send-mail</goal>
                    </goals>
                    <inherited>false</inherited>
                    <configuration>
                        <from>test123@test.com</from>
                        <subject> Test Results</subject>
                        <failonerror>true</failonerror>
                        <mailhost></mailhost>
                        <receivers>
                            <receiver>paul.lev007@gmail.com</receiver>

                        </receivers>
                        <htmlMessageFile>target/surefire-reports/emailable-report.html</htmlMessageFile>
</configuration>
                </execution>
</plugin>
Ardesco
  • 7,281
  • 26
  • 49
paul
  • 4,333
  • 16
  • 71
  • 144

2 Answers2

2

You need some kind of SMTP server for maven-postman-plugin to work.

So one solution is to install a local SMTP on Windows but maybe it's better to configure the plugin to use your company's mail server. Look at the various mail* options of the plugin.

But maybe this isn't what you want. If you just want to test sending of mails, a mail server that plays well with unit tests would be more useful (since it doesn't clog your real mail server with thousands of mails in case of an accident).

See this question for some options: Method for email testing

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • I just dont want to test but I will be sending emails do dev team everyday for success/failure both. Please suggest me a better way to solve this. I want to write a pom that would work on both windows and ubuntu. – paul Aug 29 '13 at 14:11
  • Then configure the postman plugin to use your company's proxy server. – Aaron Digulla Aug 29 '13 at 14:28
0
  1. I have installed wamp on my win7 machine
  2. I installed mercury email server Than I followed steps in this tutorial...
    http://we-like-free.blogspot.in/2010/10/how-to-configure-mercury-mail-server-on.html
paul
  • 4,333
  • 16
  • 71
  • 144