• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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: 43028
76
  • 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 ]
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic