Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Please Help! java.mail trouble shooting for MMS sending over mm3

Reply
Thread Tools

Please Help! java.mail trouble shooting for MMS sending over mm3

 
 
Andrea Maschio
Guest
Posts: n/a
 
      12-05-2003
I need to send mail relaying with an smtp server that checks the
headers section of the data field. The "TO" field should be the same
as the "RCPT TO:" command, but without domain information.
Code is just an example and it may not work. What i need is this:

HELO ...
MAIL FROM:<..>
//here it is the recipient with domain name
RCPT TO:<(E-Mail Removed)

DATA

MIME-Version: 1.0
Subject: #subject
Date: Wed, 19 Nov 2003 16:42:53 +0100
From: #from

//here it is the number without domain name.
To: +1234567890

Content-Type: multipart/mixed;
boundary="----_=_NextPart_002_01C3AEB3.CB517C80"

------_=_NextPart_002_01C3AEB3.CB517C80
Content-Type: application/smil;

[..]

<code>
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;

private String msgId;
private java.util.Vector attachments;
private int err;
private String err_description;
private String subject;
private String textbody;
private String to;
private String from;

Multipart mp = new MimeMultipart();
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);

MimeMessage msg = new MimeMessage(session);
MimeBodyPart mbp1 = new MimeBodyPart();

String host = #myserver;

props.put("mail.smtp.host", host);
session.setDebug(debug);
try {
msg.setFrom(new InternetAddress(from));
//destinatari
InternetAddress[] address = {new InternetAddress(to)};
/*---------------------------------------------------
recipients field sets "RCPT TO:" session field.
the trouble is that this field is also changed by the
msg.setHeaders("to", value) field */
msg.setRecipients(Message.RecipientType.TO, address);

//soggetto

msg.setSubject(#my subject)
msg.setSentDate(new Date());
//msg.addHeader();
//create MIME
for (int i = 0; i < attachments.size(); i++) {

String fileName = (String) (attachments.get(i));

DataSource source1 = new FileDataSource(fileName);
mbp1.setDataHandler(new DataHandler(source1));
mbp1.setFileName(fileName);

}

//aggiungo la parte al MImeBody
mp.addBodyPart(mbp1);

//inserisco i contenuti nel messaggio
/*--------------------------------------------
i've tried changing these value, but it changes also the session's "to
//property", it causes the "RCPT TO:" to be like what you set here, so
it's without domain*/

msg.setHeader("to", #number);

msg.setContent(mp);
msg.saveChanges();


Transport.send(msg);
}
catch (MessagingException mex) {

System.out.println(mex.toString())
return false;

}
</code>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use python-mms to send mms guptha Python 0 02-02-2010 06:05 AM
VOIP over VPN over TCP over WAP over 3G Theo Markettos UK VOIP 2 02-14-2008 03:27 PM
Powering off as a trouble shooting procedure Dugie Computer Support 10 01-27-2005 12:50 AM
Trouble shooting a shutdown problem Not Bill Gates Computer Support 6 04-24-2004 03:57 PM
looking for Trouble shooting guide for lockups and freezes Matt Ferrari Computer Support 8 09-18-2003 11:59 AM



Advertisments