• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javamail error

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Below is the code for sending the e-mail, getting the errors as written below the program


import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;


public class SendApp {
public static void send(String smtpHost, int smtpPort,String from, String to,String subject, String content) throws AddressException, MessagingException {
// Create a mail session
System.out.println("SMTPHostname ====>"+smtpHost);
java.util.Properties props = new java.util.Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port", ""+smtpPort);
Session session = Session.getDefaultInstance(props, null);

// Construct the message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(content);

// Send the message
Transport.send(msg);
}

public static void main(String[] args) throws Exception {
// Send a test message
send("mail.vsnl.co.in", 25,"portal.teamibm@vsnl.co.in","vinod.shirke@tcs.com","Test Mail", "How about at this mail?");
}
}


Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 454 5.7.3
Client does not have permission to submit mail to this server.

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
333)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at SendApp.send(SendApp.java:24)
at SendApp.main(SendApp.java:29)


Kindly provide some solution

Regards
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, do you have permission to access that server? You don't seem to set a username and password - without that, few email servers will accept connections.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Client does not have permission to submit mail to this server


There's your problem. Looks like you don't have permission to 454 5.7.3. Speak to your SMTP server's administrator.

(Damn - too slow!)
[ March 06, 2006: Message edited by: Paul Sturrock ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic