Sending flash content using javamail
hi
i have been trying to send a flash content by attaching the flash file and referencing in thru the "cid: " referance. This works very well with outlook express but fails in outlook2000. Could you suggest how this can be taken care of? Such a strategy for images works in outlook 2000. Local and web referances to the flash file also works.
Thanks in advance..
looking forward to some advice
DA
Hi buddy i am also facing the same prob if you have got the solution then please advice me as i require it urgently..
Rajesh
Similar Messages
-
How to bypass proxy when trying to send a mail using javamail smtp
Hi,
I am trying to make a servlet send a mail using javamail smtp protocol on port 25 but i m not able to send getting an exception, i suspect proxy is blocking, so any idea anyone how bypass a proxy.And if it does turn out that there's a proxy server blocking access to your target SMTP server, the best way to deal with that is to discuss the issue with the person responsible for your network configuration.
-
Sending a Directory using JavaMail
Hi. Can anyone tell me how to send a directory using JavaMail? Thanks.
what you can do is create a file object and load all the files one by one and attach them as a multipart object to the same mail.
anurag -
How to send secure email using JavaMail
Hi, anyone out there know how to send secure email using Java Mail? Greately appreciated.
For starters, if you have not already done so, read about it in the JavaMail design specifications.
Search for Message Security in the said document. -
Send THAI mail using JavaMail to Lotus Notes (URGENT)
Hi all
I experienced the problem when I try to use Javamail to send mail that contains THAI text to Lotus Notes . When I read my mail in Lotus Note,I cannot read it !! . What should I do ?
Please suggest .
Regards
Chairat Tiajanpan
E-Mail : [email protected]� hello!
Do you know how can I do it? I am desesperated. Please help me.
I want to send a mail to lotus notes using a Java class.
What i need to install in my computer for running the class??
Sorry for my english. I am spanish and i speak english very bad.
Thanks!! -
I have a new project into which i have to insert SWF into an HTML page using other way that the standard Abobe way to do it.
I know about Flash Satay but i have 300s Flash files to insert and dont want to reopen each of them.
My HTML pages have to W3C comply and as you know, the <classic id> or <embed> tag isnt valid regarding XHTML 1.0 Strict.
Client, who insists that his media be accessible to EVERYBODY, suggested using
"javascript:loadMedia('flashContainer','flv/v01.flv', '', '', 'fra', '','','', 'false');"><img src="images/flashFr.jpg" alt="" /></a></p>
where loadMedia is a function with these parameters
<!-- Parameters for loadMedia function
loadMedia('mediacontainer', '<file>', '<caption>', '<image>', '<lang>', '<playId>', '<height>', '<width>', '<autostart>' )
- mediacontainer - /* container that holds the player */
- file - /* Specifies the location of the file to play. */ (.flv)
- caption - /* Specifies the location of the xml-based captions file using the SMIL Timed Text format. */
- image - /* Specifies the image to display when playing MP3 or FLV files. This FlashVar can also be used to display a preview image for other formats. Supported formats are JPG, SWF, PNG, and GIF. */
- lang - /* Specifies the language of the player. */
- playId - /* Element id of the player control */
- height - /* Specifies the window height of the control. */
- width - /* Specifies the window width of the control. */
- autostart - /* AutoStart the loaded clip */
-->
Do you know about that? Can you help? Do you know any other way to insert Flash content with respect to:
- Javascript on/off valid
- XHTML 1.0 Strict valid
- WAG valid.I am VERY concerned with the fact that my pages are not being properly validated and displayed.
I have created two different sites using iWeb '08 and while I am satisfied with the ease of use, I am concerned that my sites are not being displayed correctly... in fact, the other day my friend who is a Mac whiz and who hosts my business website on his server... tried to visit the site that I created using iWeb '08 and had published to my .Mac account... it caused his browser to flat out crash! He said he hasn't seen anything like that in years!
Here is the site I have begun to build http://www.mcleanmonowheel.com
If you paste this url into http://validator.w3.org/ a slew of errors pop up.
Is this the norm with iWeb or have I done something wrong on my end???
-Patrick -
Selecting the data from database and sending to users using javamail
how to select the records from database table in oracle and send automatically to users using javamail. I am able to send the txt msg. but dont know how to send the selected table data to users automatically.
can anyone suggest how to write the steps with database connection to send msgs containing data to different users
Thank Youusing JDBC..you want to
1. create the connect
2. open the connection
3. query the table for the data
4. loop through the resultset to retrieve rows of data
5. do something with the data
6. email the result
once you have the data, it is up to you to determine the format to send to the user using JavaMail. It is easiest to send plain text
here's a site that give code example (for all steps above relating to JDBC):
http://javaalmanac.com/egs/java.sql/pkg.html -
Trying to send e-mail using JavaMail, JBoss 5, and JNDI
Hello there,
Am using JBoss 5.1.0GA and JDK 1.5.0_19 on OS X Leopard.
Created a working SendMailServlet.
Have now decided to refactor it into two separate classes (extract out JavaMail code to a separate class and create a ServletController).
Am also trying to use JNDI to access the connection properties in the mail-service.xml configuration file residing in JBoss.
The Mailer class contains the reusable functionality needed to send an e-mail:
public class Mailer {
private Session mailSession;
protected void sendMsg(String email, String subject, String body)
throws MessagingException, NamingException {
Properties props = new Properties();
InitialContext ictx = new InitialContext(props);
Session mailSession = (Session) ictx.lookup("java:/Mail");
// Session mailSessoin = Session.getDefaultInstance(props);
String username = (String) props.get("mail.smtps.user");
String password = (String) props.get("mail.smtps.password");
MimeMessage message = new MimeMessage(mailSession);
message.setSubject(subject);
message.setRecipients(javax.mail.Message.RecipientType.TO,
javax.mail.internet.InternetAddress.parse(email, false));
message.setText(body);
message.saveChanges();
Transport transport = mailSession.getTransport("smtps");
try {
transport.connect(username, password);
transport.sendMessage(message, message.getAllRecipients());
Logger.getLogger(this.getClass()).warn("Message sent");
finally {
transport.close();
}The MailController class serves as a standard Java Servlet which invokes the Mailer.class's sendMsg() method:
public class MailController extends HttpServlet {
/** static final HTML setting for content type */
private static final String HTML = "text/html";
myapp/** static final HTML setting for content type */
private static final String PLAIN = "text/plain";
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(PLAIN);
PrintWriter out = response.getWriter();
String mailToken = TokenUtil.getEncryptedKey();
String body = "Hello there, " + "\n\n"
+ "Wanna play a game of golf?" + "\n\n"
+ "Please confirm: https://localhost:8443/myapp/confirm?token="
+ mailToken + "\n\n" + "-Golf USA";
Mailer mailer = new Mailer();
try {
mailer.sendMsg("[email protected]", "Golf Invitation!", body);
out.println("Message Sent");
catch (MessagingException e) {
e.printStackTrace();
catch (NamingException e) {
e.printStackTrace();
}Have the mail configuration set under $JBOSS_HOME/server/default/deploy/mail-service.xml:
<server>
<mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">user</attribute>
<attribute name="Password">password</attribute>
<attribute name="Configuration">
<configuration>
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<property name="mail.user" value="user"/>
<property name="mail.pop3.host" value="pop3.gmail.com"/>
<property name="mail.smtp.host" value="smtp.gmail.com"/>
<property name="mail.smtp.port" value="25"/>
<property name="mail.from" value="[email protected]"/>
<property name="mail.debug" value="true"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>web.xml (Deployment Descriptor):
<servlet>
<servlet-name>MailController</servlet-name>
<servlet-class>com.myapp.MailController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MailController</servlet-name>
<url-pattern>/sendmail</url-pattern>
</servlet-mapping>This is what is outputted when I start JBOSS and click point my browser to:
https://localhost:8443/myapp/sendmail
[MailService] Mail Service bound to java:/Mail
[STDOUT] DEBUG: JavaMail version 1.4ea
[STDOUT] DEBUG: java.io.FileNotFoundException:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/javamail.providers
(No such file or directory)
[STDOUT] DEBUG: !anyLoaded
[STDOUT] DEBUG: not loading resource: /META-INF/javamail.providers
[STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
[STDOUT] DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc]
[STDOUT] DEBUG SMTP: useEhlo true, useAuth false
[STDOUT] DEBUG SMTP: trying to connect to host "localhost", port 465, isSSL true
[STDERR] javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 465;
nested exception is:
java.net.ConnectException: Connection refused
[STDERR] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
[STDERR] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
[STDERR] at javax.mail.Service.connect(Service.java:275)
[STDERR] at javax.mail.Service.connect(Service.java:156)
[STDERR] at javax.mail.Service.connect(Service.java:176)
[STDERR] at com.myapp.Mailer.sendMsg(Mailer.java:45)
[STDERR] at com.myapp.MailController.doPost(MailController.java:42)
[STDERR] at com.myapp.MailController.doGet(MailController.java:26)Why am I getting this java.net.ConnectException: Connection refused exception?
Happy programming,
Mike
Edited by: mwilson72 on Aug 21, 2009 4:49 PMHi Peter,
Nice to hear from you again!
Per your advice, this is what my mail-service.xml config file looks like now:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">user</attribute>
<attribute name="Password">password</attribute>
<attribute name="Configuration">
<configuration>
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtps"/>
<property name="mail.smtp.starttls.enable" value="true"/>
<property name="mail.smtps.auth" value="true"/>
<property name="mail.user" value="user"/>
<property name="mail.pop3.host" value="pop3.gmail.com"/>
<property name="mail.smtp.host" value="smtp.gmail.com"/>
<property name="mail.smtps.port" value="465"/>
<property name="mail.from" value="[email protected]"/>
<property name="mail.debug" value="true"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>Now, when I restart JBoss and point my browser to:
https://localhost:8443/myapp/sendmail
I get this exception:
[STDOUT] DEBUG SMTP: useEhlo true, useAuth true
[STDOUT] DEBUG SMTP: useEhlo true, useAuth true
[STDOUT] DEBUG SMTP: trying to connect to host "localhost", port 465, isSSL true
[STDERR] javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 465;
nested exception is:
java.net.ConnectException: Connection refused
[STDERR] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
[STDERR] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
[STDERR] at javax.mail.Service.connect(Service.java:297)
[STDERR] at javax.mail.Service.connect(Service.java:156)
[STDERR] at javax.mail.Service.connect(Service.java:176)
[STDERR] at com.myapp.Mailer.sendMsg(Mailer.java:45)
[STDERR] at com.myapp.MailController.doPost(MailController.java:42)
[STDERR] at com.myapp.MailController.doGet(MailController.java:26)Does anyone know what I am possibly doing wrong? Is it my code or is it the config file?
-Mike -
Getting error when sending SMTP mail using javamail api
hi all
i am new to javamail api...and using it first-time....i'v used the following code
<%
String mailHost="mail.mastsale.com";
String mailText="Hello this is a test msg";
String to="<a href="mailto:[email protected]">[email protected]</a>";
String subject="jsp test mail";
try
String from="<a href="mailto:[email protected]">[email protected]</a>";
String mailhost = "mail.mastsale.com";
Properties props = System.getProperties();
props.put("mail.smtp.host", mailhost);
// Get a Session object
Authenticator auth = new SMTPAuthenticator( "<a href="mailto:[email protected]">[email protected]</a>", "abcd" );
Session session1 = Session.getInstance(props,auth);
//Session.setDebug(true);
//construct message
Message msg = new MimeMessage(session1);
msg.setFrom(new InternetAddress(from,"Your Name"));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(mailText);
//msg.setHeader("X-Mailer",mailer);
msg.setSentDate(new Date());
msg.saveChanges();
//Send the message
out.println("Sending mail to " + to);
Transport.send(msg);
catch (MessagingException me)
out.println("Error in sending message for messaging exception:"+me);
%>
and
SMTPAuthenticator.java
import java.io.*;
import java.util.*;
import java.lang.*;
import javax.mail.*;
import javax.mail.internet.*;
public class SMTPAuthenticator extends javax.mail.Authenticator {
private String fUser;
private String fPassword;
public SMTPAuthenticator(String user, String password) {
fUser = user;
fPassword = password;
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(fUser, fPassword);
Now getting error as: Error in sending message for messaging exception:javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550-(host.hostonwin.com) [208.101.41.106] is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client.
Can anyone help me?i got the following error while using the below code,
-----------registerForm----------------
DEBUG: setDebug: JavaMail version 1.3.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
:::::::::::::::::::::::::::::::::<FONT SIZE=4 COLOR="blue"> <B>Error : </B><BR><HR> <FONT SIZE=3 COLOR="black">javax.mail.AuthenticationFailedException<BR><HR>
-----------registerForm----------------
public class SendMailBean {
public String send(String p_from, String p_to, String p_cc, String p_bcc,
String p_subject, String p_message, String p_smtpServer,String FilePath) {
String l_result = "";
// Name of the Host machine where the SMTP server is running
String l_host = p_smtpServer;
//for file attachment
String filename = FilePath;
// Gets the System properties
Properties l_props = System.getProperties();
// Puts the SMTP server name to properties object
l_props.put("mail.smtp.host", l_host);
l_props.put("mail.smtp.auth", "true");
// Get the default Session using Properties Object
Session l_session = Session.getDefaultInstance(l_props, null);
l_session.setDebug(true); // Enable the debug mode
try {
MimeMessage l_msg = new MimeMessage(l_session); // Create a New message
l_msg.setFrom(new InternetAddress(p_from)); // Set the From address
// Setting the "To recipients" addresses
l_msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(p_to, false));
// Setting the "Cc recipients" addresses
l_msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(p_cc, false));
// Setting the "BCc recipients" addresses
l_msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(p_bcc, false));
l_msg.setSubject(p_subject); // Sets the Subject
// Create and fill the first message part
MimeBodyPart l_mbp = new MimeBodyPart();
//123
///////l_mbp.setText(p_message);
l_mbp.setContent(p_message,"text/html");
// Create the Multipart and its parts to it
Multipart l_mp = new MimeMultipart();
//l_mp.setContent(html,"text/html");
l_mp.addBodyPart(l_mbp);
// Add the Multipart to the message
l_msg.setContent(l_mp,"text/html");
// Set the Date: header
l_msg.setSentDate(new Date());
//added by cibijaybalan for file attachment
// attach the file to the message
//Multipart l_mp1 = new MimeMultipart();
if(!filename.equals(""))
String fname = filename;
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource(fname);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
l_mp.addBodyPart(mbp2);
// add the Multipart to the message
l_msg.setContent(l_mp);
//ends here
l_msg.setSentDate(new java.util.Date());
// Send the message
Transport.send(l_msg);
// If here, then message is successfully sent.
// Display Success message
l_result = l_result + "Mail was successfully sent to : "+p_to;
//if CCed then, add html for displaying info
//if (!p_cc.equals(""))
//l_result = l_result +"<FONT color=green><B>CCed To </B></FONT>: "+p_cc+"<BR>";
//if BCCed then, add html for displaying info
//if (!p_bcc.equals(""))
//l_result = l_result +"<FONT color=green><B>BCCed To </B></FONT>: "+p_bcc ;
//l_result = l_result+"<BR><HR>";
} catch (MessagingException mex) { // Trap the MessagingException Error
// If here, then error in sending Mail. Display Error message.
l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
"<FONT SIZE=3 COLOR=\"black\">"+mex.toString()+"<BR><HR>";
} catch (Exception e) {
// If here, then error in sending Mail. Display Error message.
l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
"<FONT SIZE=3 COLOR=\"black\">"+e.toString()+"<BR><HR>";
e.printStackTrace();
}//end catch block
//finally {
System.out.println(":::::::::::::::::::::::::::::::::"+l_result);
return l_result;
} // end of method send
} //end of bean
plz help me -
How to Send Html Email using JavaMail?
I want to send email message body as html.
as some news sites send.What will easiest way of doing that?oops!!!
Sorry there is one more thing in it the ByteArrayDataSource class. I am posting the code in the class here. Compile it in a separate class.
class ByteArrayDataSource implements DataSource
private byte[] data; // data
private String type; // content-type
/* Create a DataSource from an input stream */
public ByteArrayDataSource(InputStream is, String type)
this.type = type;
try
ByteArrayOutputStream os = new ByteArrayOutputStream();
int ch;
while ((ch = is.read()) != -1)
// XXX - must be made more efficient by
// doing buffered reads, rather than one byte reads
os.write(ch);
data = os.toByteArray();
} catch (IOException ioex) { }
/* Create a DataSource from a byte array */
public ByteArrayDataSource(byte[] data, String type)
this.data = data;
this.type = type;
/* Create a DataSource from a String */
public ByteArrayDataSource(String data, String type)
try
// Assumption that the string contains only ASCII
// characters! Otherwise just pass a charset into this
// constructor and use it in getBytes()
this.data = data.getBytes("iso-8859-1");
catch (UnsupportedEncodingException uex)
this.type = type;
* Return an InputStream for the data.
* Note - a new stream must be returned each time.
public InputStream getInputStream() throws IOException
if (data == null)
throw new IOException("no data");
return new ByteArrayInputStream(data);
public OutputStream getOutputStream() throws IOException
throw new IOException("cannot do this");
public String getContentType()
return type;
public String getName()
return "dummy";
}hope this will help
best wishes
khuda hafiz -
Having issues playing flash content using Chrome
I have tried installing/reinstalling Flash Plugin several times. I can play content with Internet Explorer. For the same content when using Chrome I get error saysing "Could not load plug-in"
Following link shows version 11.5.502.110. I am using Windows 7 -64 bit
http://helpx.adobe.com/flash-player/kb/find-version-flash-player.html
The same link about on chrome says "could not load plug-in" thus unable to read the flash version.
On the contrary I see following at Chrome://Plugins
Shockwave Flash 11.5 r31
Name:
Shockwave Flash
Description:
Shockwave Flash 11.5 r31
Version:
11.5.31.2
Location:
C:\Users\maheshmali\AppData\Local\Google\Chrome\Application\23.0.1271.64\PepperFlash\pepfl ashplayer.dll
Type:
PPAPI (out-of-process)
Disable
MIME types:
MIME type
Description
File extensions
application/x-shockwave-flash
Shockwave Flash
.swf
application/futuresplash
FutureSplash Player
.spl
Name:
Shockwave Flash
Description:
Shockwave Flash 11.5 r502
Version:
11,5,502,110
Location:
C:\Windows\SysWOW64\Macromed\Flash\NPSWF32_11_5_502_110.dll
Type:
NPAPI
Disable
MIME types:
MIME type
Description
File extensions
application/x-shockwave-flash
Adobe Flash movie
.swf
application/futuresplash
FutureSplash movie
.spl
Disable Always allowedGoogle Chrome
23.0.1271.91 (m)
OS
Windows 7 or Server 2008 R2 SP1 64 bit
Flash plugin
11.5.31.2 C:\Users\maheshmali\AppData\Local\Google\Chrome\Application\23.0.1271.91\PepperFlash\pepf lashplayer.dll
Flash plugin
11,5,502,110 C:\Windows\SysWOW64\Macromed\Flash\NPSWF32_11_5_502_110.dll (not used)
--- Crash data ---
Crash Reporting
Enable crash reporting to see crash IDs
For more details
https://support.google.com/chrome/?p=ui_usagestat
--- GPU information ---
Graphics card
Mobile Intel(R) 4 Series Express Chipset Family
Driver display name
igdumd64.dll,igd10umd64.dll,igdumdx32,igd10umd32
Driver name (strong)
oem3.inf:Intel.Mfg.NTamd64:iCNT0:8.15.10.2226:pci\ven_8086&dev_2a42&subsys_20e417aa
--- GPU driver, more information ---
Vendor Id
0x8086
Device Id
0x2a42
Driver vendor
Intel Corporation
Driver version
8.15.10.2226
Driver date
10-15-2010
Pixel shader version
3.0
Vertex shader version
3.0
GL version
GL_VENDOR
GL_RENDERER
GL_VERSION
GL_EXTENSIONS -
Sending an Email using JavaMail from the Net Work of my company not workin
Hi,
If any body would reply to this issue as soon as possible..
I have developed a simple java mail program which sends an email to gmail (smtp.gmail.com) and works fine at home , So when i sent the same
from my office(at company) it did not work and exception was reported saying ...... could not connect to host .smtp.gmail.com... port .. .
I think it's a network problem.
So If any body has a suggestion ?
If so can any body give a simple code for this issue.
Regards,No, I don't mean the msgshow.java demo program. I mean the [JavaMail FAQ|http://java.sun.com/products/javamail/FAQ.html].
In particular, the section about debugging connection problems and the section
about connecting to Gmail.
Find it yet? -
Firefox cannot download any Flash content using Mac OS Lion
I am running Mac OS Lion (10.7) and FF 4.01 and 5 (on another Mac). I have both Flash & Video Download and Flash Video Downloader - neither works. It downloads a file showing nothing by gibberish (code).
Do you select the drive and not the partition when you use disk utility?
What is in blue is the drive, below are the existing partitions. With the drive selected, the partition tab should allow you repartition the drive and select each volumes type, ... -
Sending rtf content in javamail body
hi all,
i am trying to send a newsletter in the body of the mail instead of an attachment.
can anyone tell me how to acheive it.hi bshannon,
first of all thanks for your reply. Let me explain you what i am trying to acheive. I have a rtf doc with me with lots of images and text. I want this to go in as body of the message and not as an attachment. Here is what i am trying..
MimeMessage message = new MimeMessage(session);
message.setSender(new InternetAddress(sender));
message.setSubject(subject);
DataSource fds = new FileDataSource("D:/Documents and Settings/karthik/Desktop/test/NewsLetter.doc");
message.setDataHandler(new DataHandler(fds));
here is where i am unable to understand how to put this message.setDataHandler() thing in to the body of the message as we dont have a method addBodyPart() in mimemessage object as we have in the MimeMultipart..
message.setContent(body, "text/rtf");
Transport.send(message);
thanks again,
karthik. -
Getting exceptions while sending mail using javamail api
Hi to all
I am developing an application of sending a mail using JavaMail api. My program is below:
quote:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class sms
public static void main(String args[])
try
String strstrsmtserver="smtp.bol.net.in";
String strto="[email protected]";
String strfrom="[email protected]";
String strsubject="Hello";
String bodytext="This is my first java mail program";
sms s=new sms();
s.send(strstrsmtserver,strto,strfrom,strsubject,bodytext);
catch(Exception e)
System.out.println("usage:java sms"+"strstrsmtpserver tosddress fromaddress subjecttext bodyText");
System.exit(0);
public void send(String strsmtpserver,String strto,String strfrom ,String strsubject,String bodytext)
try
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties p=new Properties(System.getProperties());
if(strsmtpserver!=null)
p.put("mail.transport.protocol","smtp");
p.put("mail.smtp.host","[email protected]");
p.put("mail.smtp.port","25");
Session session=Session.getDefaultInstance(p);
Message msg=new MimeMessage(session);
Transport trans = session.getTransport("smtp");
trans.connect("smtp.bol.net.in","[email protected]","1234563757");
msg.setFrom(new InternetAddress(strfrom));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(strto,false));
msg.setSubject(strsubject);
msg.setText(bodytext);
msg.setHeader("X-Mailer","mtnlmail");
msg.setSentDate(new Date());
Transport.send(msg);
System.out.println("Message sent OK.");
catch(Exception ex)
System.out.println("here is error");
ex.printStackTrace();
It compiles fine but showing exceptions at run time.Please help me to remove these exceptions.I am new to this JavaMail and it is my first program of javamail.Please also tell me how to use smtp server.I am using MTNL 's internet connection having smtp.bol.net.in server.
exceptions are:
Here is exception
quote:
Javax.mail.MessagingException:Could not connect to SMTP host : smtp.bol.net.in, port :25;
Nested exception is :
Java.net.ConnectException:Connection refused: connect
At com.sun.mail.smtp.SMTPTransport.openServer<SMTPTransport.java:1227>
At com.sun.mail.smtp.SMTPTransport.protocolConnect<SMTPTransport.java:322>
At javax.mail.Service .connect(Service.java:236>
At javax.mail.Service.connect<Service.java:137>
At sms.send<sms.java:77>
At sms.main<sms.java:24>Did you find the JavaMail FAQ?
You should talk to your ISP to get the details for connecting to your server.
In this case I suspect your server wants you to make the connection on the
secure port. The FAQ has examples of how to do this for GMail and Yahoo
mail, which work similarly. By changing the host name, these same examples
will likely work for you.
Maybe you are looking for
-
I plug my ipod into my computer and it begins to charge, then in the bottom right corner it says installing device driver, and then says digital still camera failed. Im not sure what that means. Then when i open my itunes all my music is gone from m
-
Filename is a wrong argument if not .pdf - Linux Acroread 9.5.1
We recently installled acroread 9.5.1 on Linux . When we try to convert a PDF file that does not have a .pdf extension, we get the error shown below. This does not happen if the file has a .pdf extension or and does not happen with the 8.1.4 LINUX
-
Sync iPhone with Bluetooth doesn't work with me.
I have try to sync my bluetooth with my computer, and I just can make it work, I know I have to turn on my iphone's bluetooth and have it discoverable, I have done that and still not working, my macbook founds it but if I try to send something it sai
-
Problem with location.href
hi I want to create a widget but got a problem with a link. This is the html code. <body> <input type="text" id="temporaryinbox_textbox"> <select id="language"> <option value="">en</option> <option value="de/">de</option> <option value="es/">es</opti
-
Making payments from East Africa - Uganda
What is the easiest , no stress way to make payment from East Africa - Uganda. Azure does not accept registration from this market and cant use locally issues credit/debit cards and from my experience bank payments take long and are not correctly re