473,396 Members | 2,111 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,396 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 5184
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.