473,379 Members | 1,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Mails sent from Java code going to Junk Folder in MS Outlook

14
Hi Friends,

I Have written a java code to send mails to some receipients.It sends to internal mail ID's in the office. An SMTP server has been provided to me. But the problem is that the mails are being sent to Junk folder of the recepients.

1) The mail contains only plain text, it doen't have things like images or something which is treated as a SPAM or junk.

2) Since the mails are being sent to the internal mail ID's in the office, there is no point considering it to be as Junk by Outlook. (I have read in the Microsoft forums that the mails which are received from the same domain name are not considered as junk).

I am pasting the core part of the code which I am using. Please tell me if there are any problems with this.
Expand|Select|Wrap|Line Numbers
  1. public void sendMailsLogic(String to, String bcc) {
  2.         try {
  3.             Properties props = System.getProperties();
  4.             props.put("mail.smtp.host", "178.27.6.50");
  5.             props.put("mail.smtp.auth", "true");
  6.             Session session = Session.getInstanc
  7. (props, null);
  8.             session.setDebug(true);
  9.  
  10.             transport = session.getTransport("smtp");
  11.             transport.connect("178.27.6.50", "myuserName", "myPassword");
  12.  
  13.             // construct the message
  14.             Message msg = new MimeMessage(session);
  15.             msg.setFrom(new InternetAddress(from));
  16.  
  17.             msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(
  18.                     to.toString(), false));
  19.             msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(
  20.                     bcc.toString(), false));
  21.             msg.setSubject(subject);
  22.             msg.setText(text); // this is a function which has body of the mail.
  23.             msg.saveChanges(); 
  24.  
  25.             InternetAddress[] addrs = InternetAddress.parse(from, false);
  26.             //Transport tr = session.getTransport(addrs[0]);
  27.             //tr.connect();
  28.  
  29.             transport.sendMessage(msg, msg.getAllRecipients());
  30.             transport.close();
  31.             System.out.println("Message Successfully Sent");
  32.         } catch (Exception e) {
  33.             System.out.println("Exception Raised");
  34.             e.printStackTrace();
  35.         }
  36.     }
  37.  
  38.  
To the above function I am providing To and CC strings. It will only one person in TO and 4 persons in CC.

One more problem which I noticed is that when the mail is sent, it is verifying only the userID's of the people in TO and CC. It is not verifying the FROM userID. i.e even If i give a userID which I is not existing, it is sending the mail succesfully.

Ex. if the FROM is "abcdef" without @. even then it is sending the mail.


I know this is a very long post as I choose to explain in detail.
Please help me with this.

Thanks in advance... :)

Regards,
Tijnar
Dec 5 '08 #1
2 5179
Nepomuk
3,112 Expert 2GB
Hi tiijnar! I moved this here from the Jobs Forum. Please post your questions in the right place in future.

Also, as you can see, I added [code] tags for you and removed the [b] tags - read our Posting Guidelines, especially the Things that are generally unacceptable.

I'll leave the answering of this question to the other Experts here, as I'm not really familiar with javamail.

Greetings,
Nepomuk (Moderator)
Dec 5 '08 #2
JosAH
11,448 Expert 8TB
Try to send an identical message manually and see if it also ends up in the junk at the recipient's side.

kind regards,

Jos
Dec 5 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: el | last post by:
Hello, I wrote a tool which read an outlook folder and save the mails to the hard disk (in .msg files) Here below one of the main sub of my tool. I don't know why but sometimes, this...
0
by: chausan | last post by:
Update ++++++ All attchment scanned with norton anti-virus w/ yahoo mail service and they all reported infected with virus Worm.Automat.AHB. ======================================== From:...
5
by: Miguel Arenas | last post by:
In vb.2003 I sent automated e-mails, but now I need to read e-Mail and attachments what can I do ? or somebody know where can I find some code to do that. Thansk.
17
by: rdemyan | last post by:
My app creates a building report. My users have requested that I provide functionality to e-mail these "building reports" to building managers once a month. So assuming that I have the...
7
by: oopsbabies | last post by:
Hello everyone, I am using Apache 1.3.33 as the web server and PHP version 4.3.10. My machine is using Windows XP 2002 professional edition which comes with a Windows firewall. I am using McAfee...
2
by: beeswax | last post by:
Hi, Does anyone knows how to read e-mails from a specific folders in outlook? I only found out how to read the mails from the inbox folder and how to list all available folder. I just don't...
4
prabunewindia
by: prabunewindia | last post by:
Hello everybody, here i am going to explain, how to get mails from Outlook express database and store in our own database(local) Initially you have to add the refference Outlook library10.0 or...
2
AR Ratheesh
by: AR Ratheesh | last post by:
Hi Guys, Need help to sent mails using code.i have a table containing 2 fields 1.Name,2.Email ID.and an another table(Data to be attached). Private Sub Command0_Click() On Error GoTo...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.