postfix not sending email automatically - email

I am attempting to use postfix to send emails from an application. Right now when I send an email using mailx it appears that the email gets to the queue but it doesn't actually send until I flush the queue manually.
Can anyone tell me how I can get postfix to send any emails that are in the queue automatically?
Right now my test is:
mailx user#domain.com
subject: some test
this is sometest
ctl-d
When I look at the queue using postqueue or mailq the system tells me the mail queue is empty. But as soon as I flush the queue I the relay server receives the email and they get to my inbox.
Any thoughts or help would be appreciated.

Related

Automatically triggering an action on your backend from an incoming email message

Platforms like upwork have a feature where when you get a message through those platforms, you also get an email.
Instead of logging Upwork to reply, the user can simply reply to the incoming email, and the message is then automatically sent by upworks backend to the original person who sent the message.
How exactly is this done in a way that Upwork knows the inbox to send the message to, and is able to receive a message via email.
It seems Upwork handles incoming emails by detecting any project ID in the email message - it can be an ID in the subject or in the email body and etc. So, the email can be recognized easily and processed. Also additional information can be checked on the incoming email - the sender (whom the original emails was sent out), the recipient and etc. Actually, it is up to your needs how algorithm should be working.

How to send an email using Gmail's SMTP without writing it in Sent Mail

I would like to send a message using Gmail's SMTP without storing the message in the Sent Mail folder. I'm aware that SMTP doesn't write anything in the IMAP folders, but Gmail has different behaviour and it autosync the messages sent through SMTP in the IMAP folders.
Is there any way (flag, header, etc.) to avoid this auto sync behaviour when sending and email using Gmail's SMTP?
You could just delete the message from your sent folder right after you send it.
Access the sent folder and retrieve the latest message sent. Then set the flag of that message to delete
message.setFlag(Flags.Flag.DELETED, true);
Then close the folder
sentFolder.close(true);
Closing the folder will delete the flagged message from it. Code examples are in java, if you're writing in it.
Other than manually deleting the message, I don't think there is a way to disable this action.

Exim - Restrict outgoing email to be from only one address

A bot has found a way to send bulk spam through my server. My server is not an open relay. All mails are coming from localhost. The emails are being sent from a series of FIRSTNAME_LASTNAME#mydomain.com. At mydomain, there is only 1 email account that was created that we send from.
Is there a way to restrict outgoing email that are being sent through exim to only allow emails to be sent from the 1 email account we created and block all other Sent From addressed that are being created?
You have to add the next condition to your SMTP router(s):
condition = ${if match{$sender_address}{legal#mydomain.com}{yes}{no}}
I was able to resolve this by turning on X-Headers which allowed me to locate where the emails were being executed from which in turn allowed me to eliminate an exploit from an old script.

Sending an email using javamail as if it were being sent from gmail

I'm developing a web application that uses javamail to send email messages and it works correctly.
The problem is that I don't get the email that I'm sending in the sent mail folder in the gmail account which I connect to, also I don't get bounced email as it happens if I try to send the email via gmail application.
I doubt this is due to security restrictions from javamail and cannot be done, as it would be much faster to get a possible spam list from an email server than doing it manually.but if it's for security reasons it would just be much better just not to bounce emails.
How can I use javamail as if sending the mails from gmail.com, getting the sent message in the sent mail folder and bounced mails in inbox folder?
The problem is that I don't get the email that I'm sending in the sent mail folder
Sending a mail via SMTP does not copy it to a sent folder automatically. Your sending application would have to make an IMAP connection after the SMTP connection and copy the message into the sent folder.
also I don't get bounced email
Make sure the Evelope Sender Address ("Return-Path") is set to the Gmail Adress you're using to send the messages.

CRM email not appearing in queues

I have a CRM applicaton with queues setup to receive emails. It is all working as expected except for one exception.
The client is scanning letters that they receive and using a SMTP request via their exchange server to send the scanned letter to the queue in an email message. The message is being delivered to the email address but it is not going into the queue in CRM.
Relaying has been enabled on the exchange server for the CRM system. If the message is sent from a normal email address it enters the queue as expected. There is nothing in the Trace logs or the event viewer on the CRM server to indicate why the message is not going into the queue.
Can anybody provide me with some suggestions as to why this could be happening?
Thanks,
Neil
Turns out the mails weren't entering the mailbox at all