Results 1 to 21 of 21

Thread: Sending mail, revisited

  1. #1

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935

    Sending mail, revisited

    How can I send an e-mail message from Java or JSP!? I've tried JSP tag libraries, the J2EE mail classes, everything and nothing has worked. Does somebody have a working example?

  2. #2

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    BTW, I tried the Jakarta mailer taglib but never got it working. I copied the files and everything, but I'm having trouble on what to do with the XML files. But a pure Java approach will work too.

  3. #3
    Addicted Member
    Join Date
    Nov 2001
    Location
    Yewston, Texis
    Posts
    240
    Have you resolved this one yet?

    If not, could it be your SMTP host is not allowing you to talk?

    cudabean

  4. #4

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    I've gotten a multitude of responses at the Java forums (http://forums.java.sun.com/thread.js...&thread=210841). But for various reasons none has worked. Sending manual SMTP commands doesn't work either. WHY THE HELL DOES THIS HAVE TO BE SO COMPLICATED FOR SUCH A SIMPLE THING!?

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    I'd ditch jsp if I were you and go with PHP. It's piss easy, just call a function with subject message args. You can send mime too

  6. #6

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Eh, then I'd have to rewrite my entire site to PHP, including the beast that is the RHHSHN

  7. #7
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    oh right...damn!

    Well for future reference

  8. #8

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Since AFAIK PHP is cross-platform just like JSP, if you know of a way to do it with PHP, not to mention get some PHP compiler and Apache to cooperate, then I can do this sendmail thing with PHP...

  9. #9
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    PHP and Apache are so good together they could get married . Get PHP from www.php.net

    This is a demo I used to experiment with for sending mail. For plain text, use as is, for HTML, uncomment the mime header lines
    PHP Code:
    <?php

    /* recipients */
    $to  "Someone <[email protected]>" ", " //note the comma
    $to .= "someone else <[email protected]>";

    /* subject */
    $subject "Birthday Reminders for August";

    /* message */
    $message '
    <html>
    <head>
     <title>Birthday Reminders for August</title>
    </head>
    <body>
    <p>Here are the birthdays upcoming in August!</p>
    <table>
     <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
     </tr>
     <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
     </tr>
    </table>
    </body>
    </html>
    '
    ;

    /* To send HTML mail, set the Content-type header. */
    //$headers  = "MIME-Version: 1.0\n";
    //$headers .= "Content-type: text/html; charset=iso-8859-1\n";

    /* additional headers */
    $headers .= "From: Birthday Reminder <[email protected]>\n";

    /* and now mail it */
    mail($to$subject$message$headers);

    ?>

  10. #10

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    *downloads the Win32 binary distro for Apache*

    Since the documentation for a Win32 install is about 30 pages how's about a really quick walkthough of making it be able to compile pages that are in d:\apacheroot?

  11. #11
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    sorry, not a clue. My host deals with all that.

  12. #12

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Well it installed but I've got to read though the blasted documentation to get it working with Apache

  13. #13
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    let me know how you get on. Also you could spill the beans on how you set up apache web server

  14. #14

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    I read the documentation , but only the section for Apache on Win32 which was only a couple of pages. It works; Apache starts up saying Apache/PHP/Tomcat running instead of the normal Apache/Tomcat running, so let's try out this page of yours.

  15. #15

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Eh, it sorta broke my site. The file I'm working on is http://www.turtletips.com/phpfiles/sendmail.php but no matter where I go I get an Error 500.

  16. #16

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Apache said:
    Code:
    68.55.34.129 - - [29/Jan/2002:22:50:04 -0500] "GET /apacheroot/ HTTP/1.1" 500 622

  17. #17

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    http://turtletips.dns2go.com:8082/ap...s/sendmail.php

    Erm, it at least recognizes it as a PHP file...but it broke all the JSP stuff

  18. #18

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    NM, stupid error on my part. But now I get an error on this line:
    Code:
    mail($to, $subject, $message, $headers);
    Code:
    Warning: Server Error in d:\apacheroot\phppages\sendmail.php on line 22
    ?

  19. #19
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    damn. Just thought I'd point out that is a .php3 file. Might make a difference since a new interpreter engine was introduced in php 3, and you probably have 4.11 installed.

    As for the mail function, you have to configure php so it knows where your sendy maily proggy is (whatever it is).

  20. #20

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Originally posted by chrisjk
    As for the mail function, you have to configure php so it knows where your sendy maily proggy is (whatever it is).
    *has no idea how to do that*

  21. #21
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width