-
send emails using smtp
i used the following code for sending a mail.
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="fromaddr";
String to="toaddr";
try{
SmtpClient client = new SmtpClient("server");
client.from(from);
client.to(to);
out.println("client");
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending email from JSP!");
message.println("This was sent from a JSP page!");
message.println();
message.println("Cool beans! :-)");
message.println();
message.println();
client.closeServer();
}
catch (IOException e){
out.println("ERROR SENDING EMAIL:"+e);
}
%>
for the server i dont know what to give. It says:
ERROR SENDING EMAIL:sun.net.smtp.SmtpProtocolException: 550 5.7.1 Unable to relay for toaddr.
for toaddr i given a valid address and also from adr i given a valid address.
just help me out.
-
The problem was with the server. I gave the correct server name. It works with correctly with the above code......
-
Cool beans indeed
>I suck at this game, can you give me some pointers?
>> 0x278AB4FF, 0xB5822BB4, 0xAD6E673D.
> I hate you.

Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
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
|
|
Bookmarks