How to prevent emails as spam?

If an email is sent from our application server(running on AIX) to an id that is outside of the organization like gmail etc, and if gmail should not treat the mail as spam, what has to be done from unix level?

We want to help you, but, in order to do that, we have to understand what you are trying to do.

Are you saying that mail you are sending to users with email addresses ending with @gmail.com and the people receiving that mail are marking it as spam? Are you asking how to keep users who receive your mail from marking it as spam?

If there was a flag that could set a flag to say "This is not spam" when sending a message, then every spammer would set it, so it would be of no use. There is nothing you can tag onto the message to say you are legitimate.

As far as I am aware, the rules to whether a message is spam or not may be set at many places in the delivery route. Some organisation filter outgoing mail, some ISPs filter and potentially blacklist mail and those receiving it also will. You will possible have to trace a your message through with the people that manage the various parts to see where it is getting blocked and negotiate for it's release/reclassification.

Of course with a gmail address as the target, this will be very difficult if you can see it leaving your organisation but it still does not arrive.

Sorry to not have better news/suggestions.

Robin

Gmail uses its own scanning and logic to know whether the incoming mail on their mailboxes is SPAM, promotional, solicited or un-solicited mail.

then based on feedbacks from various users they would internally classify your mail server and the action they want.
what I mean feedback is they seem to calculate how many of those mails were moved to inbox by users, how many tried un-subscribing, and how many reported it as phishing or spam.

There's no hard or fast rule, but if you play fair and safe, Gmail would have no problems accepting your mail directly to their users Inbox.

Do you send the email out through the same outbound server as the rest of your company email?
If you are sending the email out directly from the AIX machine, then you need to have a reverse dns entry.

Gmail marks anything that fails a reverse DNS check as spam

Which email software are you using on your AIX server? If it is something like "sendmail" then explore the Domain Masquerade function to ensure that the email appears to be sent from your company's external DNS-registered domain name. Further enhancements would be ensuring that the return path email address is a valid email address and that the Subject line is unique.

Spoofing server-generate email so that it will get past spam filters is an art which thankfully many of the spammers have not mastered.

If you are not spamming it should be go to directly to inbox. Gmail has very smart filters, I guess they do check on how many similar emails are there, minor differences like adding random numbers or text will confirm it as spam.

Other things you should look at if your domain or any IP's are blacklisted.

gmail uses following way to check spam, Check URL: Mark or unmark Spam in Gmail - Computer - Gmail Help

If you have registered users for specific email subscription; Have then add to white list. Else if you are spamming on random emails, then it will be reported and your product and company can also get banned.