Web Hosting Forum | Lunarpages

Scripting Languages Hosting Help => JSP and Servlets Support => Topic started by: Kelvin on March 28, 2004, 03:30:39 PM



Title: JavaMail Example / Wrapper
Post by: Kelvin on March 28, 2004, 03:30:39 PM
Hi Folks,

I've uploaded a new JavaMail wrapper and example Jsp,  You can download it from

http://lunarwarriors.com/jsp/Mail.war

This version allows for Authentication to be switched on and off,  html based emails, multiple recipients (also CC & BCC).  Please read/edit the sendmail.jsp before using. Note as usual this is not supported by Lunarpages, any questions must be directed to this forum.


Title: JavaMail Example / Wrapper
Post by: babckok on October 01, 2004, 10:10:00 PM
It's working on tomcat server but not on Lp server.


Title: JavaMail Example / Wrapper
Post by: faisal on October 03, 2004, 05:49:57 AM
It does work with lunar pages as I have proof of it. See
http://www.renjo.com/contactus.jsp
I have just used it as it is and only change the jsp.

Thanks for the help Kevin!


Title: JavaMail Example / Wrapper
Post by: babckok on October 03, 2004, 09:51:22 AM
What files did you put in the lib folder?


Title: JavaMail Example / Wrapper
Post by: faisal on October 04, 2004, 12:59:29 AM
Hi,
ativation.jar
and mail.jar

You should keep the class file same and then in the jps you need to make changes like specify your server address, password, login etc. Also specify "to" and "from".

It runs fine.

Faisal


Title: JavaMail Example / Wrapper
Post by: gvivek99 on October 23, 2004, 11:21:01 AM
I am testing this from my local system trying to use to send mail using LP SMTP server. But I am always getting

javax.mail.MessagingException: Could not connect to SMTP host: www.xxxx.com , port: 25

Any advice.

Thanks
gvivek99


Title: JavaMail Example / Wrapper
Post by: Danielle on October 23, 2004, 11:41:21 AM
Hi gvivek99,

Is that the actual error message or did you replace your domain name with www.xxx.com ?  Also, you should not use www.domain.com for the SMTP host as www. is HTTP not SMTP.  Please use domain.com instead.

Thanks.


Title: JavaMail Example / Wrapper
Post by: gvivek99 on October 23, 2004, 01:51:48 PM
Sorry about typo mistake. I used domain.com as I got in my welcome mail.
 I am tryinh my program from command line. Is that a problem.

Thanks


Title: JavaMail Example / Wrapper
Post by: GMTurner on October 23, 2004, 05:27:38 PM
You might also want to make sure that your ISP has not blocked port 25.. more and more ISPs are blocking port 25 to make sure that you only use their SMTP server.... for your email client, are you able to use your domain as the SMTP server, or do you have to use your ISPs?


Title: JavaMail Example / Wrapper
Post by: gvivek99 on October 23, 2004, 08:22:09 PM
Hi GM,
           I think I should able to use my domain as SMTP server. I am not sure that to use SMTP server at LP. I have to be in their network or I can use these server from outside word too.

I am having one SMTP server on my local system and it works good to me. So it does not sounds ISP issue.

Hope this will help
Thanks


Title: Re: JavaMail Example / Wrapper
Post by: colora22 on March 04, 2005, 10:36:21 PM
I moved Mail.war to my public_html/webapps directory.  The only files
being extracted by resin are the class files for a bean.  I can't seem to find
any sendmail.jsp.

Prior to trying this I uploaded both mail.jar and activation.jar to my
WEB-INF/lib directory (I got these jars from java.sun.com) and am
still receiving a error message of:

package javax.mail not found on import

our domain name is coloradorealestatelocator.com
can't figure out which machine it is on. . . .

ed hubbard
ehubbard@eosdesigns.com
530.448.6792



Quote from: Kelvin
Hi Folks,

I've uploaded a new JavaMail wrapper and example Jsp,  You can download it from

http://lunarwarriors.com/jsp/Mail.war

This version allows for Authentication to be switched on and off,  html based emails, multiple recipients (also CC & BCC).  Please read/edit the sendmail.jsp before using. Note as usual this is not supported by Lunarpages, any questions must be directed to this forum.


Title: JavaMail Example / Wrapper
Post by: moilejterNotLoggedIn on April 26, 2005, 07:47:37 PM
Well - I ran into some trouble with my email web page, modeled on Kelvin's.  To test things out, I am now using the exact same JavaMail wrapper and example JSP that Kelvin mentions, in a web app I set up in my own web site.  But it seems to be broken :-(.  When I try to use it, I get this error:

Unable perform SMTP Send, Cause: javax.mail.SendFailedException: Invalid Addresses; nested exception is: class javax.mail.SendFailedException: 451 Temporary local problem - please try later

I am pretty sure my email web page used to work, until late last week - but support tells me nothing has changed on mars that could affect this... Any ideas?

Thank you!

Moises


Title: JavaMail Example / Wrapper
Post by: moilejterNotLoggedIn on April 26, 2005, 09:42:06 PM
It seems the problem had to do with the return address specified for the email.  I used to use xyz@www.software-smiths.com (my site) - and I swear it used to work! :-)  But changing that return email address to xyz@software-smiths.com (just the domain) fixed it.  Thanks to tech support! :-)

Moises


Title: Re: JavaMail Example / Wrapper
Post by: thepo2 on August 22, 2005, 12:34:34 PM
The link to the .war file doesn't work.  Can someone post a new link?


Title: Re: JavaMail Example / Wrapper
Post by: moilejter on August 26, 2005, 07:38:33 PM
With no promises, you can get a copy (I think it is a copy of the original Kelvin wrote) here:
http://www.software-smiths.com/Mail.zip
Notice this is not the original WAR file - just a copy of the expanded WAR, in ZIP form...

Moises


Title: Re: JavaMail Example / Wrapper
Post by: Danielle on August 27, 2005, 09:55:33 PM
I have updated the war file location in both posts.  It is also in our FAQ on the Help Desk (the better location to get it as that updates when the url updates):

http://helpdesk.lunarpages.com/faq.php?do=article&articleid=114

Thanks.


Title: Re: JavaMail Example / Wrapper
Post by: tobias on September 20, 2005, 12:30:39 PM
I am using the javamail example and am getting the following error message

webapps/members/WEB-INF/classes/jdbc/MailBean.java:23:
Package javax.mail not found in import.
import javax.mail.*;
       ^
webapps/members/WEB-INF/classes/jdbc/MailBean.java:24:
Package javax.mail.internet not found in import.
import javax.mail.internet.*;
       ^
webapps/members/WEB-INF/classes/jdbc/MailBean.java:25:
Package javax.activation not found in import.
import javax.activation.*;

but the import statements are present in the bean...

can anyone help me with this??

many thanks


Title: Re: JavaMail Example / Wrapper
Post by: moilejter on September 24, 2005, 07:21:47 AM
You have to download the JavaMail and Java Activation Framework APIs and install the corresponding jar files (mail.jar and activation.jar?) to your WEB-INF/lib folder...

Moises


Title: Re: JavaMail Example / Wrapper
Post by: tobias on September 28, 2005, 06:46:08 AM
thanks for that moises, i've put both the activation.jar and mail.jar in the lib folder of WEB_INF but now i am gettin this message:

Undefined variable, class, or package name: javax
          mimemessage.setRecipients(javax.mail.Message$RecipientType.TO, ainternetaddress);

anyone got any ideas?
thanks


Title: Re: JavaMail Example / Wrapper
Post by: Eidolon on December 15, 2006, 05:38:35 AM
Change that line to instead of having "Message$RecipientType.TO" to "Message.RecipientType.TO".


Title: Re: JavaMail Example / Wrapper
Post by: mabadrah on April 12, 2007, 01:03:59 AM
I'm trying to download the wrapper froom "http://lunarwarriors.com/jsp/Mail.war" but it needs authentication!!!
I tried my fourms' login name and my lunar pages' account as well, but they didn't work.

How should I get this wraper and example code?!!

Thanks in advance


Title: Re: JavaMail Example / Wrapper
Post by: appts2 on October 23, 2007, 04:01:18 PM
Hey..I was hoping to use your mail.war file for a problem I'm having w/ sending mail.

But..when I try to download it..i'm prompted for a id/pswd.

Any thoughts..

thanks

Wm


Title: Re: JavaMail Example / Wrapper
Post by: appts2 on October 23, 2007, 04:28:01 PM
Kevin,
thanks for the note about the war file...but when i try to access..it prompts me for a lunarwarriors id/pwsd.

a. How wld I get one of these.
b. Cld you just send it to me @ wfkinnc@bellsouth.net

Thanks

Wm


Title: Re: JavaMail Example / Wrapper
Post by: onepavel on November 04, 2008, 05:04:03 PM
Hello!

I use javamail, and cannot send mail =(
code:

Code:
    String host = "krypton.lunarpages.com";
    String user = "login_to_ftp";
    String password = "password_to_ftp";
   
    Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.auth", "true");
   
    Session mailSession = Session.getDefaultInstance(props, null);

    try {   
      MimeMessage msg = new MimeMessage(mailSession);
   
      msg.addRecipient(Message.RecipientType.TO, new InternetAddress("onepavel@yandex.ru"));
      msg.setFrom(new InternetAddress("newsletter@iconsoft.com"));
      msg.setSubject("Test");
      msg.setText("Hi");

      Transport transport = null;
      transport = mailSession.getTransport("smtp");
      transport.connect(host, user, password);
      transport.send(msg);

    }
    catch (Exception e)  {
       PrintWriter writer = new PrintWriter(out);
       e.printStackTrace(writer);
    }
    finally {
        if (transport != null) {
            try { transport.close(); }
             catch (MessagingException e) {}
        }
    }

I receive result:
  javax.mail.AuthenticationFailedException at javax.mail.Service.connect(Service.java:319)
  at javax.mail.Service.connect(Service.java:169)
  at javax.mail.Service.connect(Service.java:118)
  at javax.mail.Transport.send0(Transport.java:188)
  at javax.mail.Transport.send(Transport.java:118)
  at _jsp._sender__jsp._jspService(_sender__jsp.java:65)
  at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
  at com.caucho.jsp.Page.subservice(Page.java:506)
  at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
  at com.caucho.server.http.Invocation.service(Invocation.java:315)
  at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
  at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
  at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
  at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
  at java.lang.Thread.run(Thread.java:534)

What's the problem?
I think, I use wrong passwords.

Please, help me.


Title: Re: JavaMail Example / Wrapper
Post by: onepavel on November 05, 2008, 04:09:47 AM
I have replaced myself mail.jar and activation.jar from wrapper and all has earned.


Title: Re: JavaMail Example / Wrapper
Post by: vks87 on April 06, 2009, 11:33:13 PM
I agree with badckok...


Title: Re: JavaMail Example / Wrapper
Post by: kdorsey on June 22, 2009, 10:53:47 AM
I(https://bodybuilderspro.info/customimages/65/1240197088/random.gif) have updated the war file location in both posts.  It is also in our FAQ on the Help Desk (the better location to get it as that updates when the url updates):

http://helpdesk.lunarpages.com/faq.php?do=article&articleid=114

Thanks.

I wish I would have seen this like 3 months ago.  Was struggling mightily with java.