Sending mail problems
Hi
I have this program that it works independetly but when I create an object from it from another program, it doesn't go through after the creation of the session.It stops at Message msg = new MimeMessage(session); can some one help me and tell me the problem .thanks
import java.io.PrintWriter;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
public class Test3 {
public void send(String to,String from,String message){
String cc = "";
String bcc = "";
String host = "smtp-gw.fr.world.socgen";
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.debug", "true");
try {
Session session = Session.getInstance(props);
// Here is the problem when it doesn't go throught
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO,address);
if(cc !=null)
{msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(cc,true));}
if(bcc !=null)
{msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(bcc,true));}
msg.setSubject("Error Message");
msg.setSentDate(new Date());
msg.setContent(message, "text/plain");
Transport.send(msg);
System.out.println("yes");
catch (MessagingException ex){
System.err.println("Cannot send the email. " + ex);
}
The error that I am getting is :
javax.servlet.ServletException: Servlet execution threw an exception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
root cause
java.lang.NoClassDefFoundError: javax/activation/DataSource
test3.send(test3.java:48)
Password.doGet(Password.java:137)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
and I have already imported the javax.activation.*
Thanks in advance
Similar Messages
-
Germany - sending mail problem
as many before am not able to send mail from my private email account - neither via edge nor when using wifi. However it works from my .Mac account. It is an SMTP issue. My ISP tells me that the server drops after ehlo. In order to gather some more information, I have this question to the proud folks sporting a new t- mobile iPhone since Friday:
What SMTP server is recomended by t-mobile when sending via edge (if they do recomend one at all)?
Anyone having the same problems out there with an idea why theserver may drop conection and a work around (other than using a different ISP)
Thanx,
ChristophNot sure but since .Mac's SMTP server is authenticated and this works when sending messages from the iPhone with your .Mac account, this indicates your ISP's SMTP server is not authenticated or something else is wrong.
Did you transfer the account settings from your computer to the iPhone via the iTunes sync process?
If so, try deleting the account and manually recreating the account on the iPhone but if this works and you did transfer the account settings from your computer to the iPhone via the sync process, be sure to deselect this option before the next sync or your changes made on the iPhone will be overwritten. -
hello
pleze i tried to send mails from a servlrt in my application
i tried it from a sample in tomcat sendmail.jsp which is connect with
a servlet that manuplates the name and content for tha mail
the problem is
i can't do it from my application which take this servlet and
put it in WEB-APP in the Root it gave me an exception
javax.naming.NameNotFoundException: Name mail is not bound in this Context
pleze help how can i manuplate with it to put it in my application in root
thanxu've got to put your code on the screen so we can have a look at what u might be doing wrong
-
Yet another can receive, but can't send mail problem.
I’m having trouble with Mail. I have reviewed the various posts by others who have a similar problem. I’ve tried their suggestions, but none have worked for me. I just bought a new G5 PowerMac. I have set the account preferences exactly like my PowerMac G4 and PowerBook G4, but I cannot send messages on any account. I can receive messages. When I try to forward a message by clicking the forward button, nothing happens - no new reply window appears. Likewise, when I compose new message and click the send button nothing happens. My setting are correct and the same as the other Macs noted above. Both of them will send and receive messages using the same DSL connection as the G5. I have two hard drives on my G5 both with OS 10.4.3 installed. I use the second drive to start up on when I have trouble with my main drive. I started on the other drive, which had no mail settings, and tried to set up my accounts. In this case I got a message stating that the mail server could not be accessed. I went ahead and set the accounts anyway, then made sure the settings were correct. This implies that there is something wrong with my new G5 or there is a bug with Mail using the G5 since I have no problems with the other Macs. I haven't time to contact the help line and hope someone knows how to fix this problem.
Hi Dancing Brave,
Thanks for visiting Apple Support Communities.
I recommend starting with the steps in this article if you are not able to send mail:
OS X Mail: Troubleshooting sending and receiving email messages
http://support.apple.com/kb/ts3276
Best,
Jeremy -
Send Mail Problem with .Mac
I cand send mail successfully from other accounts configured on the phone(both POP and IMAP), but I get errors when sending from my .Mac account.
I found this article:
http://www.wireless.att.com/support/knowledgeBase.do?content=KB72769.html
...but .Mac account config pages on the iPhone don't provide a field for Outgoing Server to change. Actually, this article fixed the problem with my other accounts.Thanks for the reply, Nathan.
I had already found that article. Snip below...
iPhone includes preset configurations for many of the
popular providers such as Yahoo! Mail, Gmail, .Mac,
and AOL, and in most cases sending mail will just
work.
However if you are using a different provider
than above...
Unfortunately, if you select ".Mac" for type of
account, the configuration screen does not provide a
field at all for Outgoing Server. This suggestion
only works if you are not using one of the providers
listed. It is apparently hardcoded by Apple when you
choose ".Mac". I also tried to fool it by creating a
generic IMAP account, but providing my .Mac info.
This didn't work either.
then don't select .mac, just select "Other", then select POP (or IMAP).
incoming mail server: mail.mac.com
outgoing mail server: smtp.mac.com:587
enter in your username and password
i set up my .Mac email manually by selecting "Other" and choosing POP and it is working fine. -
hello all,
I have two databases one in a DMZ and one that is not call it (local)
On local I have created a mail procedure that can send mail to users.
The same procedure does not work on the machine in the DMZ.
I thought it might have something to do with being in the DMZ
so I created an account in microsoft express and sent my self a message which I recieved.
Any help on why I can't get the database procedure to work would be apprecieated.
<<<<<<Code Below >>>>
CREATE OR REPLACE PROCEDURE "CFULLER"."MAIL" ( TOPERSON IN
VARCHAR2,FROMPERSON IN VARCHAR2,MESSAGE IN VARCHAR2)
IS
mailhost VARCHAR2(64) := '[email protected];
recipient VARCHAR2(64) := TOPERSON;
sender VARCHAR2(64) := FROMPERSON;
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.open_data(mail_conn);
utl_smtp.write_data(mail_conn,MESSAGE);
utl_smtp.write_data(mail_conn,'Mail host'||mailhost);
utl_smtp.write_data(mail_conn,'get_user: ' || wwctx_api.get_user );
utl_smtp.write_data(mail_conn,'get_user_id: ' || to_char(wwctx_api.get_user_id));
utl_smtp.write_data(mail_conn,'get_db_user: ' || wwctx_api.get_db_user);
utl_smtp.write_data(mail_conn,'get_product_version: ' || wwctx_api.get_product_version );
utl_smtp.write_data(mail_conn,'get_product_schema: ' || wwctx_api.get_product_schema);
utl_smtp.write_data(mail_conn,'logged_on: ' || to_char(wwctx_api.logged_on));
utl_smtp.write_data(mail_conn,'get_sessionid: ' || wwctx_api.get_sessionid);
utl_smtp.write_data(mail_conn,'get_login_time: ' ||to_char(wwctx_api.get_login_time,'MM/DD/YYYY HH24:MI:SS'));
utl_smtp.write_data(mail_conn,'get_ip_address: ' || wwctx_api.get_ip_address);
utl_smtp.write_data(mail_conn,'get_nls_language: ' || wwctx_api.get_nls_language);
utl_smtp.write_data(mail_conn,'get_public_user: ' || wwctx_api.get_public_user);
utl_smtp.write_data(mail_conn,'get_sso_schema: ' || wwctx_api.get_sso_schema);
utl_smtp.write_data(mail_conn,'get_proxy_server: ' || wwctx_api.get_proxy_server);
utl_smtp.write_data(mail_conn,'get_image_path: ' || wwctx_api.get_image_path);
utl_smtp.write_data(mail_conn,'get_proc_path: ' || wwctx_api.get_proc_path ( 'home', 'portal30'));
utl_smtp.write_data(mail_conn,'get_server_protocol: ' || wwctx_api.get_server_protocol );
utl_smtp.write_data(mail_conn,'get_sso_proc_protocol: ' || wwctx_api.get_sso_proc_path ('home', 'portal30_sso' ));
utl_smtp.write_data(mail_conn,'get_server_name: ' || wwctx_api.get_server_name );
utl_smtp.write_data(mail_conn,'get_dad_name: ' || wwctx_api.get_dad_name );
utl_smtp.close_data(mail_conn);
utl_smtp.quit(mail_conn);
EXCEPTION
WHEN utl_smtp.INVALID_OPERATION then
DBMS_OUTPUT.PUT_LINE ( 'INVALID_OPERATION : '|| sqlcode ) ;
WHEN utl_smtp.TRANSIENT_ERROR then
DBMS_OUTPUT.PUT_LINE ( 'TRANSIENT_ERROR : '|| sqlcode ) ;
WHEN utl_smtp.PERMANENT_ERROR then
DBMS_OUTPUT.PUT_LINE ( 'PERMANENT_ERROR : '|| sqlcode ) ;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Others : '|| sqlcode ) ;
end mail
;The only thing I am getting for output is a value of 1
If I comment out the portal api calls in this message it works fine.
I am going to pass these values in a function call to a variable and concatenate them.
I wish there was a example of tieing the utl_smpt mail functionality with the portal environment.
This make life a lot easier to know what the person was doing when they had the problem.
crf -
Send mail problem having invalid address with correct addresses
I used java mail api to send mails. the code is a s below
javax.mail.Session mailSession=(javax.mail.Session)ctx.lookup("java:/Mail");
mailSession.setDebug(false);
javax.mail.Message msg = new javax.mail.internet.MimeMessage(mailSession);
msg.addRecipients(javax.mail.Message.RecipientType.TO, addressToArr);
msg.setSubject(mailSubject);
msg.setContent(mailBody, contentType);
javax.mail.Transport.send(msg);
But if there is an invalid address in the recipient address array, the email won't be sent to the correct addresses as well. i just want to know whther it happens any coding issues or our mail server implementation.Hi!
You need to activated properties config mail.smtp.sendpartial to true :
// Setup partial mail
props.put("mail.smtp.sendpartial", (new Boolean(partial)).toString());
if the recipient address array have bad address, it will still be sent to good address...
or/and check email address before send mail :
public static boolean isValidEmail(String email)
if (email == null) return false;
boolean valid = true;
try
InternetAddress addr = new InternetAddress(email);
addr.validate();
catch (AddressException ex)
valid = false;
return valid;
}regards, -
Hi,
i am trying to send mail via ODI send mail package and getting error below,
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.1 Client was not authenticated
any advise pls
thank youODI is sending the email without a password which is the behavior of OdiSendMail.
Where as your mail server is looking for a authenticated mail i.e. which has password , this is why you are getting this error.
For OdiSendMail , use a mail server which does not requires an authentication
Else use customized Jython mail sending procedure ... see details in ODIsendmail error -
Sending Mail problem - Very Urgent
I want to send mail through the Java code using struts framework.It works fine olny with the authentication.I want suggestions for sending mails without authentication.
{color:red}CROSS POSTED{color}
{color:0000ff}http://forum.java.sun.com/thread.jspa?threadID=5245789
{color}
Cross posting is rude.
And as I noted on the other thread, looks like a identity fraud requirement to me.
db -
HT201320 Hi , I'm with outlook but I can no longer send mail, problem
What can I do about not being able to send mail? I'm with outlook
Hi there stan137,
You may find the troubleshooting steps in the article below helpful.
iOS: Troubleshooting Mail
http://support.apple.com/kb/ts3899
-Griff W. -
Sending mail problem on iPod Touch
Suddenly, and I mean suddenly, I cannot send mail from my Touch. It tells me that "sender address is invalid." I checked all my settings and my contact info and all is correct. Anyone have any idea what's going on? I can get mail but can't send without that warning message.
If you can send mail from your mac, did you try to replace the account settings on your iPod, using this option in the info pane, advanced section? Then try again to send mails.
-
Sending mail Problem (Urgent Please)
The following program mail coding program. I am in local System. Host is my server. But our Server (norton) firewall is enabled. I am not able to send any mail. Will you please tell me How to recover this problem or alter my coding. If anybody knows Please tell me.
<html>
<head>
<title>JSP JavaMail Example </title>
</head>
<body>
<%@ page import="java.util.*" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
<%
try
String host = "xxx.xxx.x.x";
String to = request.getParameter("to");
String from = request.getParameter("from");
String subject = request.getParameter("subject");
String messageText = request.getParameter("body");
boolean sessionDebug = false;
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol", "smtp");
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(messageText);
Transport.send(msg);
out.println("Mail was sent to " + to);
out.println(" from " + from);
out.println(" using host " + host + ".");
catch(Exception e)
System.out.println("Error");
%>
</table>
</body>
</html>
Please tell me how to recover this problem
Thanks in advance
regards
poojaPlease tell me my mail coding is correct. If correct but i am not able receive any mail. what is the problem do u know. If you know please tell me
regards
pooja -
Sending mail problem (please help)
I have downloaded all necessary components javamail-1_2.zip and jaf1_0_1.zip. I included them in my classpath too (activation.jar and mail.jar). I used Exchange Server 2000 as smtp server. But when i try sending an email the message appears like this:
sending error cannot relay for sending [email protected]
When i tried the same code in my ISP (www.mycgiserver.com) it work very fine. Here is the code. Where is the problem? Please help me...
<%
// Take massege properties
String mBody = request.getParameter("mBody");
String from1 = request.getParameter("from");
String to1 = request.getParameter("to");
String subject = request.getParameter("subject");
Properties props = new Properties();
props.put("ipNo.........:25", "smtp.mail.blah.com");
Session s = Session.getInstance(props,null);
Message message = new MimeMessage(s);
InternetAddress from = new InternetAddress(from1);
message.setFrom(from);
InternetAddress to = new InternetAddress(to1);
message.setRecipient(Message.RecipientType.TO, to);
message.setText(mBody);
message.setSubject(subject);
Transport.send(message);
%>the problem i feel is in your smtp relay and probably not in ur code . some smtp relay servers are configured such that they relay only on authentication or from a specific IP or from a specific subnet mask only to prevent spammers . check out the info on ur local relay server and also see other postings specific on relay ....that shud be of help i guess
-
SENDING MAIL PROBLEM??IN MY COLLEGE PC
Hi,
This is the program i done in netbeans IDE 6.5 for sending email through javamail...its works perfectly in my home PC..[BUT ITS NOT WORK IN MY COLLEGE] COULD YOU GIVE SUGGESTION REGARDING THIS..
<%
Properties props= new Properties();
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host","smtp.gmail.com");
// pop3Props.setProperty("mail.pop3.port", "995");
Authenticator auth=new MyAuthenticator(session.getAttribute("name").toString(),session.getAttribute("pass").toString());
Session s=Session.getInstance(props, auth);
MimeMessage message=new MimeMessage(s);
InternetAddress from=new InternetAddress("[email protected]","XXXXXXXXX");
message.setFrom(from);
InternetAddress to =new InternetAddress(request.getParameter("to"));
message.addRecipient(Message.RecipientType.TO,to);
message.setSubject(request.getParameter("sub"));
message.setText(request.getParameter("text"));
Transport.send(message);
%>
ERROR::
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
root cause
javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
root cause
java.net.UnknownHostException: smtp.gmail.com
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1_02 logs.Thanks Mr.Drclap
yeah i ask my sys administrator..this is problem of smtp server in my college server...
thats why i can send any message through java mail...
Bye.. -
Here, on a unique iMac:
Under user X session (admin), i can't send message with Mail App.
But, on user Y session, i can.
Both users use the same SMTP config!
Anybody understand something? Or can resolve this issue?
Thank you...
ChrisChikita, welcome to the Forum!
It may be that your user's preference/and or cache file has become corrupted. Clearing the cache files is the easiest to try first - you can download a free application called ONYX that will do the job nicely.
If that doesn't help you can trash the preference file in yourusername/Library/Preferences/com.apple.mail.plist although this will mean having to set up your accounts again (although you only need to try one to test) andhopefully that should solve it.
Maybe you are looking for
-
Long time to open Garageband 08
Garageband is taken an exceptionally long time to load up. I was initially getting a Error message advising me check it was installed properly. After some investigating I found an old Vst plugin demo was still installed, and after deleting the progra
-
I waited too long to get around to buying one and now newegg and zipzoomfly are both out of stock... They are few and far between on ebay... are they being discontinued? Hopefully there are still some out there (pref. under $300)...
-
Lion takes long time to find free space after emptying trash
After emptying the trash, I've noticed that Lion does not see the additional free space until after doing a reboot, and even after that it takes a long time for it to find all the new free space. Anybody know what's wrong with the trash system?
-
How to unblock bbm pin from block list
How to unblock bbm pin from block list, i deleyed a bbm pin and close option for no block that pin, now how can i unblock that pin.
-
Can someone help with a OpenCV DLL example?
OpenCV is an Open Source computer vision library released by intel. It is very handy for face reconition. There is a third party group called HyTek automation that created a commercial LV OpenCV wrapper called IVision, nice by if you just want to u