Announcement

Collapse
No announcement yet.

Email versenden aus JSP

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Email versenden aus JSP

    Hallo habe folgender mailer bei mir im Einsatz, leider funktioniert dieser nur ohne authentifiaktion. Wie füge ich noch eine Authentifikation ein?

    Code:
    <%!
    private void sendMail( String mailServer, String subject,
                             String to, String from, String messageText )  
    {
      try 
      {						 
         SmtpClient mailer = new SmtpClient( mailServer );
         mailer.from( from );
         mailer.to( to );  // More than one recipient may be separeted by commas
         // Get the PrintStream for writing the rest of the message
         java.io.PrintStream ps = mailer.startMessage();
         // Write out any mail headers
         ps.println( "From: " + from );
         ps.println( "To: " + to );
         ps.println( "Subject: " + subject );
         // Write out the message body
         ps.println( messageText );
         // Send the message
         mailer.closeServer();
      }
      catch ( Exception e ) {
         System.out.println( "Exection in function sendEmail" );
         System.out.println( e.getMessage() );
      }
    }
    %>

    Gruss und vielen Dank

  • #2
    Hallo Rocco1979,

    du nutzt die Klasse aus dem sun.net.smtp.smtpclient? Wie wäre es stattdessen mit der JavaMail? Der javax.mail.Authenticator ist leicht eingebaut, etwa wie in diesem Beispiel http://www.tutego.com/blog/javainsel...ll-google.html

    Beste Grüße

    Christian Ullenboom | http://www.tutego.com/

    Comment


    • #3
      ok, vielen Dank. werde es demnächst ausprobieren.

      gruss

      Comment

      Working...
      X