In my J2EE application I need to send faxes.Our fax server is Right Fax software and this software allows us to send faxes prepared by e mail.
All you have to do is writing the mail address in tihs format
<your-name>@<your fax number>@fax server name.
For this reason I will use java mail api but this api does not allow me the syntax above.
(Gives the javax.mail.internet.AddressException: Illegal character in domain in string ``Hattusas@02122968599@RFAX'' for example, when I type
addressTo[0] = new InternetAddress("Hattusas@02122968599@RFAX"
msg.setRecipients(Message.RecipientType.TO, addressTo);
)
here is my complete syntax all about this:
try
{
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
System.out.println("hi!!!"
props.put("mail.smtp.host", "10.0.0.20"
//My e mail server's addresss
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
// create a message
MimeMessage msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress("ssipahi@hotmail.com"
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[1];
addressTo[0] = new InternetAddress("Hattusas@02122968599@RFAX"
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject("Java Mail"
//msg.setContent("Content", "text/plain"
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText("Text Goes Here"
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource("c:\\FAX\\1030353522031404D.html"
//My Attachment
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
Transport.send(msg);
}
catch (Exception ex)
{
System.out.println(ex.toString());
}
Any suggestions? Salih Sipahi
Software Engineer.
City of Istanbul Turkey
openyourmind77@yahoo.com
All you have to do is writing the mail address in tihs format
<your-name>@<your fax number>@fax server name.
For this reason I will use java mail api but this api does not allow me the syntax above.
(Gives the javax.mail.internet.AddressException: Illegal character in domain in string ``Hattusas@02122968599@RFAX'' for example, when I type
addressTo[0] = new InternetAddress("Hattusas@02122968599@RFAX"
msg.setRecipients(Message.RecipientType.TO, addressTo);
)
here is my complete syntax all about this:
try
{
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
System.out.println("hi!!!"
props.put("mail.smtp.host", "10.0.0.20"
//My e mail server's addresss
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
// create a message
MimeMessage msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress("ssipahi@hotmail.com"
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[1];
addressTo[0] = new InternetAddress("Hattusas@02122968599@RFAX"
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject("Java Mail"
//msg.setContent("Content", "text/plain"
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText("Text Goes Here"
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource("c:\\FAX\\1030353522031404D.html"
//My Attachment
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
Transport.send(msg);
}
catch (Exception ex)
{
System.out.println(ex.toString());
}
Any suggestions? Salih Sipahi
Software Engineer.
City of Istanbul Turkey
openyourmind77@yahoo.com