Problem in sending mail , help
hi,
i have written the following class to send mail , when i run the compiled file it gives following error
Exception in thread main
java.lang.NoClassDefFound Error javax/activation/Daatasource
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class SenderClass
String sentAddr,fromAddr,smtpServer,body,subject;
public SenderClass(String from,String to,String smtps,String subj,String messagetext)
fromAddr=new String(from);
sentAddr=new String(to);
smtpServer=new String(smtps);
body=new String(messagetext);
subject=new String(subj);
public void send()
try
Properties props = System.getProperties();
props.put("mail.smtp.host",smtpServer);
Session session = Session.getDefaultInstance(props,null);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(fromAddr));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(sentAddr,false));
msg.setSubject(subject);
msg.setText(body);
msg.setHeader("Survey","MailCheck");
msg.setSentDate(new Date());
Transport.send(msg);
catch(Exception ex)
ex.printStackTrace();
public static void main(String args[])
SenderClass s = new SenderClass(args[0],args[1],args[2],args[3],args[4]);
s.send();
}
Here is an up to date example of sending mail with authentication and SSL. To send without SSL change smtps to smtp in the following code:
http://rademailhosting.com/javamail/javamailssl.html
Similar Messages
-
Problem: Cannot send mail unless Password is transmitted insecurely & Port is set to 587.. Can receive mail but can't send Code 501..
Need help with T-bird.. My OS is Win XP-64..Have been using Mozilla for about 10 years with little or no problems.. This happened when I upgraded to 3.17.. Spent hours on T-Bird diagnostics web site.. Called Comcast & talked to a net tech.. he ran some tests on his end & had me log into my Comcast e-mail account & all worked well,, so he concluded the problem was in T-Bird.. He had me change my port to 587 & disable connection security & authentication to none & I was able to send mail.. That was all he could do.. Comcast was working.. the problem is in T-Bird.. Can any one help with this problem.. I don't want to send mail with my password transmitted insecurely..
Thanks
RichardIt was not intended to be "snide". You said two separate things that at face value would be out of the ordinary.
I considered if it might be a typo for 31.7. Since 31.5 is the current formal release, I would have to thank you for volunteering to test a pre-release beta version. If it was truly 3.1.7 then it would appear that you have chosen, or have become stuck with a somewhat ancient version. In either case it's harder to reach out to you with any meaningful comments or advice. However I do watch various other sites and newsgroups and I don't see a clamour of distressed users, so it seems fair to suppose that this feature isn't actually broken in 31.7.
And you said XP 64. XP is obsolete and no longer supported and if there is a 64-bit version, then again you have set yourself apart from the mainstream.
I had a look at the comcast site and found some puzzling recommendations. Some users come here asking how to set up a secured connection in Thunderbird when it isn't offered by the server. Comcast are different, in that they mention the ports 143 and 587, and also 993 and 465. So far so good, in that security is actually on offer, but they also suggest that you enable SSL, regardless of which port is being used. It would be unusual and unconventional to offer TLS or SSL on ports 143 and 587. STARTTLS would be more credible on these ports.
Have you tried IMAP on 993 and SMTP on 465? SMTP on 587 with SSL, or TLS, is not impossible, but is improbable. -
Problem in sending mails to multiple persons
Hi,
I have a problem in sending mails to multiple people....
My mail is using the local smtp server...The mail is to be send to multiple addresses in to and cc.
for e.g the to address will have --> [email protected];[email protected]
cc address will have --> [email protected];[email protected]
How do this i.e set multiple to and cc address...
My function that sends mail from my ejb looks like this...
// create some properties and get the default Session
Properties props = new Properties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, null);
try{
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
//I HAVE TO SET MULTIPLE "TO" ADDRESSES HERE INSTEAD OF JUST 1
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
//I HAVE TO SET MULTIPLE "CC" ADDRESSES HERE INSTEAD OF JUST 1
InternetAddress[] addresscc = {new InternetAddress(cc)};
msg.setRecipients(Message.RecipientType.CC, addresscc);
msg.setSubject(msgSubj);
msg.setSentDate(new java.util.Date());
msg.setText(msgText);
Transport.send(msg);
}catch (MessagingException ex) {
System.out.println("\nException handling in javaMail.java :" + ex);
Please help me out with a solution!!!Thanks in advance.
Thanks
RahulHi all,
Got the solution...
We have to use addRecipients method of the Message class to add as many receipts we want to set.
example: Message.addRecipients(type,address).
Thanks
Rahul -
Hi all,
I'm having some problem in sending mail. I did all configuration regarding this. After that when i tried to send mail, its giving some error, tht is, "SendMailService is not available".
Can anybody help me on this.
Thanks,
RajHi Raj,
Go to System Administrator > System Configuration > Knowledge Management > Content Management > Global Services > Mailing Service and make active option true, then restart your portal. Hope it'll work fine.
Regards,
Ganpati Jha -
Problem of sending mail with MTA
Hi,
I have installed Sun Messaging Server, but I have a problem to send mail to other SMTP server over internet, like gmail, hotmail... So I have tried to send an email using javamail and I get this exception "530 5.7.1 Relaying not allowed", that mean that I don't have a Relay SMTP to routing the messages. But the idea that I have, is that the MTA installed with Messaging Server play the role of SMTP Relay.
So this idea is true, so I think is can be I problem of configuration, and I need to have may own SMTP Relay and don't using ISP Relay.
and I thank you for your help,
Mabrouk.GS1-Tunisia wrote:
21-Nov-2008 17:32:31.58 tcp_local Q 1 [email protected] rfc822;[email protected] [email protected] TCP active open: Failed connect() Error: Connection timed out
This indicates that Messaging Server is unable to connect to the yahoo mail servers.
I have configured my server to use mydomain.com with ip 41.x.x.xHow did you configure your server to achieve this -- what settings did you add/change?
but when I see this log [email protected] is converted to [email protected] and 192.168.3.2 is mailhost which is behind firewall in DMZ, So it may be the problem of NAT, I don't know!!!
Given that Messaging Server cannot connect to the yahoo mail servers, the problem appears to be at the networking level so the firewall is most likely blocking the outgoing port 25 connection.
When you are on the Messaging Server system, what output do you get for the following command:
telnet a.mx.mail.yahoo.com. 25Regards,
Shane. -
Problem with sending mail throgh java mail api
hi folks,
We are having problem regarding sending mail using java mail api.
we are using msgsendsample.java file from demo folder contained in javamail-1.3.3_01 folder.
we are using following command at dos prompt.:
java msgsendsample [email protected] [email protected] smtp.mail.yahoo.com false
It gives following Exception:
--Exception handling in msgsendsample.java
com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for hel
p go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
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 msgsendsample.main(msgsendsample.java:93)
** ValidUnsent Addresses
[email protected]
Thanking in Advance...
Please give us guidance to any alternate solution if exists.hi
the smtp server u are using should allow u to send mail to other smtp server like if u r sending mail to yahoo account u have to use yahoo smtp server only .....
bye -
Problem in sending mail from VF03
Hi
I am just getting a problem in sending mail to the recipient from script.
please find the below code and let me know why there is no data in otf_tab table.
DATA: otf_tab TYPE TABLE OF itcoo WITH HEADER LINE.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = i_itcpp
TABLES
otfdata = otf_tab
EXCEPTIONS
OTHERS = 1.
IF otf_tab[] IS NOT INITIAL.
TRY.
CREATE OBJECT mailer
EXPORTING
i_nast = nast.
mailer->get_mail_address( EXPORTING i_adrnr = vbdkr-adrnr ).
mailer->get_mail_address( EXPORTING i_adrnr = vbdkr-adrnr
i_vkorg = vbdkr-vkorg
i_vtweg = vbdkr-vtweg ).
zcl_sd_mail_output=>convert_otf_to_pdf( IMPORTING pdf_xstring =
gv_pdf_string
CHANGING otf_table =
otf_tab[] ).
mailer->build_and_send_email( EXPORTING pdf_xstring =
gv_pdf_string ).
CATCH zcx_sd_mail_no_mailid INTO error.
error_txt = error->get_text( ).
zcl_sd_mail_output=>protocol_update( msg_id = 'VN'
msg_nr = '902'
msg_ty = 'E'
msg_v1 = error_txt ).
retcode = 1.
CLEAR error_txt.
ENDTRY.
ENDIF.
Since my OTf_tab is initial i am unable to send mails.Hi,
If the OTF Data table is blank then you might have missed the parameter "GETOTFDATA" at the time of calling "OPEN_FORM". Please pass field TDGETOTF = "X" in paramter "OPTIONS" when you are calling "OPEN_FORM".
You can also visit this link for more information.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556?QuickLink=index&overridelayout=true
Cheers, -
Problem in sending mail through dynamics actions
Hi Friends,
I have a problem in sending mail through dynamics actions . In this we pass a subroutine in dynamics actions which send an mail when promotion action occured.
Problem is that sometimes it will send an mail or sometimes not. I have no idea to solve this problem.
Can anyone suggest me .
Thanks ,
Anish
Moderator message : Duplicate post locked.
Edited by: Vinod Kumar on Sep 5, 2011 9:45 AMHi,
Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
thank You -
PROBLEM IN SENDING MAIL TO POSITIONS THROUGH SEND MAIL STEP
Hi Experts,
I am facing some problems in sending mail to positions from the organization structure from the send mail step.When I am using user as the recipient type it is working fine...but when i am choosing S position as the recipient type it is giving the error in the workflow log stating that method SENDTASKDESCRIPTION cannot be executed.
I need to find a solution urgently...any suggestion would be sincerely appreciated.
thanks.
NarsinghWell you have probably tried this.. but just a recheck.
1 . send email setep select Organizational Object
2. Recipient Type Organizational Unit
3. Here do an F4 and then select the Unit...
Try this SAP behaves weirdly at times...
after this do Refresh Buffers.. and Org Unit...
Let us know if this works -
Hi All,
I added the mailserver part in the rwbuilder.conf file.This is how it looks
<pluginParam name="mailServer">smtp.xxx.com</pluginParam>
The smtp server of our company is working fine.
Now when i am sending mail frm report builder i am getting the error.
Pls tell me .....
Do i have to configure any other file?
Should the smtp server be running in my local machine?WHAT IS THE SOLUTION ...FOR THIS PROBLEM?
Please someone give me some guidance..
regards,
ashokHi,
Pls give some idea ......
your reply will be greatly appreciated.
regards,
ashok -
Problem wiht sender mail adapter.
Hello.
I have a mail to RFC scenario.
There sender mail adapter fails if the mails in the inbox is encoded in specific formats.
I think the mail adapter does not understand this encoding.
Below is the error i got.
error occured: [2008-09-08T08:22:25Z] 5 new messages found; processing message 1exception caught during processing mail message[1]; java.io.UnsupportedEncodingException: utf-7; processing message 2exception caught during processing mail message[2]; java.io.UnsupportedEncodingException: utf-7; processing message 3exception caught during processing mail message[3]; java.io.UnsupportedEncodingException: utf-7; processing message 4exception caught during processing mail message[4]; java.io.UnsupportedEncodingException: utf-7; processing message 5exception caught during processing mail message[5]; java.io.UnsupportedEncodingException: utf-7; action[s] taken
Is there a solution 2 overcome this problem.
I tries to use a module called "TextCodepageConversionBean" but it was not of much use.
Please help.
Thanks,
VigneshHI
Mail adapter does not understand "UTF-7" as shown in the error.
Mail adapter supports only
base64
Quoted-Printable
http://help.sap.com/saphelp_nw70/helpdata/EN/23/c093409c663228e10000000a1550b0/content.htm
If you want to make your adapter more than this. Then create a custom module using open libraries that will allow you to read many Encoding standards.
Thanks
Gaurav -
Problem with Sender Mail Adapter
Hi experts,
I'm developing a Mail-XI-RFC scenario and have a problem in the mapping. I have created a MI based in the structure of the attachment of the mail. I have a mapping that does xml->RFC and tests OK. When I send a mail to the account of the sender adapter, the system generates two payloads, the 'MailMessage' and the 'MailAttachment-1' that is the xml to map, but I have an error in SXM_MONI 'Cannot produce target element /ns0:...RFC name'.
The Sender Adapter configuration uses message protocol XIPAYLOAD, I have checked Mail Package, base 64 and keep Attachments. Interface namespace is the same as the xml and default interface name is the message interface created of type my xml.
What is wrong?
Best Regards,
Alfredo Lagunar.In this case you need to use payloadswap bean for swapping the payload and attachment
http://help.sap.com/saphelp_nw04/helpdata/en/70/f3cbad30ee479cb15672219f3405f0/frameset.htm
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step check this
Rajesh
Edited by: Rajesh on Feb 4, 2009 2:52 PM -
I've installed the OCS R1 Singlebox on a windows 2000 server.
But now I have the problem to send Email. The "Mailer-Daemon" send me the following message back.
Von: "Mail Delivery Subsystem" <[email protected]>
An: <[email protected]>
Cc:
Betreff: Could not deliver mail: see transcript for details
Datum: Nov 12, 2003 11:17 PM
Priorit�t: NORMAL
Mime-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status; BOUNDARY="----ORCL_ES6_BOUNCE_1062----"
Anh�nge:
----- The following addresses had delivery problems -----<[email protected]> (unrecoverable error)
From: "Mail Delivery Subsystem" <[email protected]>To: [email protected]: 1.0Content-Type: multipart/report; report-type=delivery-status; BOUNDARY="----ORCL_ES6_BOUNCE_1062----"Date: Thu, 13 Nov 2003 00:17:05 +0200Subject: Could not deliver mail: see transcript for details------ORCL_ES6_BOUNCE_1062----Content-Type: text/plain ----- The following addresses had delivery problems -----<[email protected]> (unrecoverable error)------ORCL_ES6_BOUNCE_1062----Content-Type: message/delivery-statusReporting-MTA: dns; server1-hecht.hecht.comReceived-From-MTA: DNS; server1-hecht.hecht.comFinal-Recipient: RFC822; [email protected]: failedStatus: 5.0.1Diagnostic-Code: SMTP; 501 5.5.4 Invalid AddressRemote-MTA: DNS; bluewin.chLast-Attempt-Date: Thu, 13 Nov 2003 00:17:05 +0200------ORCL_ES6_BOUNCE_1062----Content-Type: message/rfc822Return-Path: <[email protected]>Received: from server1-hecht.hecht.com by server1-hecht.hecht.com with ESMTP id 10621068678981; Thu, 13 Nov 2003 00:16:21 +0200Message-ID: <2076777.1068678981559.JavaMail.SYSTEM@server1-hecht>Date: Thu, 13 Nov 2003 00:16:21 +0100 (CET)From: [email protected]: [email protected]: Mime-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: quoted-printableX-Priority: 3X-Mailer: Oracle Webmail Client(UIX)------ORCL_ES6_BOUNCE_1062------
Please help me
Thanksu should configer the relay server in the smtp_out on the um_messageing
-
Problem in sending mail using java mail api
This is the pogram I am using as of now to send a mail to yahoo id.
import javax.mail.*;
import javax.mail.internet.*;
public class SendingMail2
public SendingMail2()
try
String from = "ravikiran_sunrays";
String to = "[email protected]";
String subject = "the subject u wanna send ";
String cc="[email protected]";
String bcc="[email protected]";
String text="the matter that u wanna send ";
java.util.Properties prop = System.getProperties();
prop.put("mail.smtp.host","mail.yahoo.com");
//prop.put("http.proxyHost",System.getProperty("http.proxyHost"));
//prop.put("http.proxyPort","8080");
//prop.put("http.proxyPort",System.getProperty("http.proxyPort"));
//prop.put("http.proxyHost","172.19.48.201");
//System.getProperties().setProperty("http.proxyPort","8080");
//System.getProperties().setProperty("http.proxyHost","172.19.48.201");
Session ses = Session.getInstance(prop,null);
MimeMessage message = new MimeMessage(ses);
try
Address fromAddress = new InternetAddress(from);
message.setFrom(fromAddress);
message.setSubject(subject);
Address[] toAddress = InternetAddress.parse(to);
Address[] cc_address=InternetAddress.parse(cc);
Address[] bcc_address=InternetAddress.parse(bcc);
message.setRecipients(Message.RecipientType.TO,toAddress);
message.setRecipients(Message.RecipientType.CC,cc_address);
message.setRecipients(Message.RecipientType.BCC,bcc_address);
message.setSentDate(new java.util.Date());
message.setText(text);
Transport.send(message);
System.out.println("Mail Successfully Sent");
catch(Exception e)
System.out.println("Problem " + e);
catch(Exception e)
System.out.println("Problem " + e);
public static void main(String[] args)
SendingMail2 sendingMail2 = new SendingMail2();
This is the exception I am getting when I try 2 execute that program.
avax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: mail.yahoo.com;
nested exception is:
java.net.UnknownHostException: mail.yahoo.comlisten buddy
this is a class i made it is easy to understand it sends mails and check inbox just adduser from telnet with remote manager in james create the three accounts i am using and then use this class and its methods
also the next class that contains the mails test my class and what i am saying
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class MailClient
extends Authenticator
public static final int SHOW_MESSAGES = 1;
public static final int CLEAR_MESSAGES = 2;
public static final int SHOW_AND_CLEAR =
SHOW_MESSAGES + CLEAR_MESSAGES;
protected String from;
protected Session session;
protected PasswordAuthentication authentication;
public MailClient(String user, String host)
this(user, host, false);
public MailClient(String user, String host, boolean debug)
from = user + '@' + host;
authentication = new PasswordAuthentication(user, user);
Properties props = new Properties();
props.put("mail.user", user);
props.put("mail.host", host);
props.put("mail.debug", debug ? "true" : "false");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
session = Session.getInstance(props, this);
public PasswordAuthentication getPasswordAuthentication()
return authentication;
public void sendMessage(
String to, String subject, String content)
throws MessagingException
System.out.println("SENDING message from " + from + " to " + to);
System.out.println();
MimeMessage msg = new MimeMessage(session);
msg.addRecipients(Message.RecipientType.TO, to);
msg.setSubject(subject);
msg.setText(content);
Transport.send(msg);
public void checkInbox(int mode)
throws MessagingException, IOException
if (mode == 0) return;
boolean show = (mode & SHOW_MESSAGES) > 0;
boolean clear = (mode & CLEAR_MESSAGES) > 0;
String action =
(show ? "Show" : "") +
(show && clear ? " and " : "") +
(clear ? "Clear" : "");
System.out.println(action + " INBOX for " + from);
Store store = session.getStore();
store.connect();
Folder root = store.getDefaultFolder();
Folder inbox = root.getFolder("inbox");
inbox.open(Folder.READ_WRITE);
Message[] msgs = inbox.getMessages();
if (msgs.length == 0 && show)
System.out.println("No messages in inbox");
for (int i = 0; i < msgs.length; i++)
MimeMessage msg = (MimeMessage)msgs;
if (show)
System.out.println(" From: " + msg.getFrom()[0]);
System.out.println(" Subject: " + msg.getSubject());
System.out.println(" Content: " + msg.getContent());
if (clear)
msg.setFlag(Flags.Flag.DELETED, true);
inbox.close(true);
store.close();
System.out.println();
====================================
testing this class
=======================================
public class JamesConfigTest
public static void main(String[] args)
throws Exception
// CREATE CLIENT INSTANCES
MailClient redClient = new MailClient("red", "localhost");
MailClient greenClient = new MailClient("green", "localhost");
MailClient blueClient = new MailClient("blue", "localhost");
// CLEAR EVERYBODY'S INBOX
redClient.checkInbox(MailClient.CLEAR_MESSAGES);
greenClient.checkInbox(MailClient.CLEAR_MESSAGES);
blueClient.checkInbox(MailClient.CLEAR_MESSAGES);
Thread.sleep(500); // Let the server catch up
// SEND A COUPLE OF MESSAGES TO BLUE (FROM RED AND GREEN)
redClient.sendMessage(
"blue@localhost",
"Testing blue from red",
"This is a test message");
greenClient.sendMessage(
"blue@localhost",
"Testing blue from green",
"This is a test message");
Thread.sleep(500); // Let the server catch up
// LIST MESSAGES FOR BLUE (EXPECT MESSAGES FROM RED AND GREEN)
blueClient.checkInbox(MailClient.SHOW_AND_CLEAR);
=======================================================
it suppose to print this
Clear INBOX for red@localhost
Clear INBOX for green@localhost
Clear INBOX for blue@localhost
SENDING message from red@localhost to blue@localhost
SENDING message from green@localhost to blue@localhost
Show and Clear INBOX for blue@localhost
From: green@localhost
Subject: Testing blue from green
Content: This is a test message
From: red@localhost
Subject: Testing blue from red
Content: This is a test message
thanks a lot
but i need ur help plzzzzzzzzzzzz
i can create account from telnet
but how i can create a new account from java .. a jsp page that i made to create a new account on the server
plzzzzzzzz help me
bye -
Java Session problem while sending mail(using javamail) using Pl/SQL
Hello ...
i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
pls any help.props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
Please format your code when you post the next time, there is a nice 'code' button above the post area.
Mike
Maybe you are looking for
-
How do I set TB so it does NOT alert me when junk mail arrives?
I keep TB up most of the time in the background while I work because I frequently get emails from my clients and family during the day. The problem is that I also get a lot of junk mail and so TB is also constantly notifying me of this junk mail. Thi
-
I had recently deleted all songs synced with my iPod from my itunes library. Intending to add a song to the iPod, I connected it to my computer. The iPod started syncing and since there were no more songs in the itunes library except the one I intend
-
PowerView Drill down to details list
Great to have PowerView discussion forum. :) Would it be possible to drill the PowerView dashbord to the details list like SSRS sub-reports. For example: PowerView dashboard that display Yr, make, model car types, and would like to drill to details
-
Why can't I install Quicktime Plugin?
I can't watch trailers on the Trailer page using Chrome. I get the message to get Quicktime. I have Quicktime installed. - Quicktime works fine. - In chrome:plugins I can't see The Quicktime. - When I go to download quicktime it just takes me to Soft
-
'Tab Groups' surely has an automatic mode whereby a group is dynamically defined by 'similar URLs'
The question says it all I think but my particular interest comes from not having a better principle (I used to have automatically common-coloured tabs but I forget how - perhaps Stylish...) of making a subset of tabs with a common theme (in this cas