|
-
Jan 19th, 2002, 02:28 PM
#1
Thread Starter
Member
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?
-
Jan 19th, 2002, 03:01 PM
#2
Thread Starter
Member
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.
-
Jan 29th, 2002, 06:05 PM
#3
Addicted Member
Have you resolved this one yet?
If not, could it be your SMTP host is not allowing you to talk?
cudabean
-
Jan 29th, 2002, 08:43 PM
#4
Thread Starter
Member
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!?
-
Jan 29th, 2002, 08:53 PM
#5
PowerPoster
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
-
Jan 29th, 2002, 09:16 PM
#6
Thread Starter
Member
Eh, then I'd have to rewrite my entire site to PHP, including the beast that is the RHHSHN
-
Jan 29th, 2002, 10:03 PM
#7
PowerPoster
oh right...damn!
Well for future reference
-
Jan 29th, 2002, 10:12 PM
#8
Thread Starter
Member
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...
-
Jan 29th, 2002, 10:20 PM
#9
PowerPoster
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);
?>
-
Jan 29th, 2002, 10:22 PM
#10
Thread Starter
Member
*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?
-
Jan 29th, 2002, 10:24 PM
#11
PowerPoster
sorry, not a clue. My host deals with all that.
-
Jan 29th, 2002, 10:27 PM
#12
Thread Starter
Member
Well it installed but I've got to read though the blasted documentation to get it working with Apache
-
Jan 29th, 2002, 10:32 PM
#13
PowerPoster
let me know how you get on. Also you could spill the beans on how you set up apache web server
-
Jan 29th, 2002, 10:41 PM
#14
Thread Starter
Member
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.
-
Jan 29th, 2002, 10:45 PM
#15
Thread Starter
Member
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.
-
Jan 29th, 2002, 10:49 PM
#16
Thread Starter
Member
Apache said:
Code:
68.55.34.129 - - [29/Jan/2002:22:50:04 -0500] "GET /apacheroot/ HTTP/1.1" 500 622
-
Jan 29th, 2002, 10:55 PM
#17
Thread Starter
Member
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
-
Jan 29th, 2002, 11:05 PM
#18
Thread Starter
Member
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
?
-
Jan 30th, 2002, 09:38 AM
#19
PowerPoster
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).
-
Jan 30th, 2002, 11:03 AM
#20
Thread Starter
Member
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*
-
Jan 30th, 2002, 11:31 AM
#21
PowerPoster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|