• 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
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

smpt java mail woes

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having problems with getting through my ISP smtp server.

I can connect using the parameters I am using in code on a telnet session no problem , but with the following code
I get a error 501 syntax HELO hostname
for the life of me. I cant see the problem
nor can I find out from telus what hostname they are being sent
so I am stuck

can others help?
peter richards

here's the telnet session - the names have been changed to protect the innocent

220 priv-edmwaa05.telusplanet.net ESMTP
HELO [email protected]
250 priv-edmwaa05.telusplanet.net
mail from:[email protected]
250 Ok
RCPT to: [email protected]
250 Ok
data
subject: test message
jlhgjhgljhgljkgljk
.
250 Ok: queued as 52MKTWBNCA
quit


here's the code

package jFudge;

import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;

public final class newMailerBean extends Object implements Serializable {

/* Bean Properties */

private String from = "[email protected]";
private String to = "[email protected]";
private String subject = "info";

public static Properties props = null;
public static Session session = null;

static {
/* Setting Properties for STMP host */
props = System.getProperties();
props.put("mail.smtp.host", "smtp.telus.net");
props.put("mail.smtp.auth", "true");
session = Session.getDefaultInstance(props, null);
}
/* Setter Methods */
public void setTo(String to) {
this.to = to;
}

public void setFrom(String from) {
this.from = from;
}

public void setSubject(String subject) {
this.subject = subject;
}
String messagebody = "mmmmmmmmmmmmmmmmmmm";
public void setMessage(String messagebody) {
this.message = message;
}
/* Sends Email */
public void sendMail() throws Exception {

MimeMessage message = new MimeMessage(session);
message.setRecipient(Message.RecipientType.TO,
new InternetAddress(this.to));
message.setFrom(new InternetAddress(this.from));
message.setSubject(this.subject);
message.setText(messagebody);
Transport transport = session.getTransport("smtp");
transport.connect("smtp.telus.net","a5a9999","myPassword");
message.saveChanges();
transport.sendMessage(message, message.getAllRecipients());
transport.close();

}
 
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Start by including in your property-setting section this:Then you will see the entire conversation between your code and the server appear on your console. That should give you something to tell the nice support people at Telus.
 
peter richards
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the code. indded it does display the handshake converstaion. However, I solved the problem another way. I installed a local smtp server on one of the computers in the pool and we write to that and the local smtp server then sends the email to the correct destination. ( why it is not blocked at my ISP, I don't quite understand ) but then that's computers for you.
peter richards
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
can you tell me which SMTP server you have.I downloaded freesmtp server but look like it is having someproblem since it will always say that invalid receipient I amn't sure why...I am connected to net using SBC Yahoo DSL.I amnot sure if they would do something about my local freesmtp server.I use localhost as the name of SMTP server..it is connected as i have put it ondebug but the problem is with the 504....invalid reciepeint..
Appreciate any help

THnks
 
reply
    Bookmark Topic Watch Topic
  • New Topic