Email is receiving but not sending

SYSTEM INFORMATION
Ubuntu Server 22.04 LTS (HVM)
Virtualmin version 7.7

Hello please help!
I installed virtualmin in my ubuntu server using Amazon EC2 under free tier
I tried lots of time but i’m not able to send email using virtualmin, Its fine for receiving emails to accounts but when i send email its says email was send but not receive. I checked everything bin, trash, spam, junk but email was not received

I use to send email using Gmass SMTP test email tool and this log i’m getting

Connected to smtp://mail.doamin.com:587/?starttls=when-available

<< 220 test.domain.com ESMTP Postfix (Ubuntu)

>> EHLO [000.00.00.000]

<< 250-test.domain.com

<< 250-PIPELINING

<< 250-SIZE 10240000

<< 250-VRFY

<< 250-ETRN

<< 250-STARTTLS

<< 250-AUTH PLAIN LOGIN

<< 250-AUTH=PLAIN LOGIN

<< 250-ENHANCEDSTATUSCODES

<< 250-8BITMIME

<< 250-DSN

<< 250-SMTPUTF8

<< 250 CHUNKING

>> STARTTLS

<< 220 2.0.0 Ready to start TLS

>> EHLO [000.00.00.000]

<< 250-test.domain.com

<< 250-PIPELINING

<< 250-SIZE 10240000

<< 250-VRFY

<< 250-ETRN

<< 250-AUTH PLAIN LOGIN

<< 250-AUTH=PLAIN LOGIN

<< 250-ENHANCEDSTATUSCODES

<< 250-8BITMIME

<< 250-DSN

<< 250-SMTPUTF8

<< 250 CHUNKING

>> AUTH PLAIN AGFkbWluQHNtdHBob3N0LmNsb3VkADZZeXBZTmI5dHNGYnVUZQ==

<< 235 2.7.0 Authentication successful

>> MAIL FROM:<admin@domain.com> SIZE=578

>> RCPT TO:<test-fig407g0q@srv1.mail-tester.com>

<< 250 2.1.0 Ok

<< 250 2.1.5 Ok

>> DATA

<< 354 End data with <CR><LF>.<CR><LF>

>> From: admin@domain.com

>> Date: Mon, 11 Sep 2023 17:42:08 퍍

>> Subject: SMTP test from mail.smtphost.cloud

>> Message-Id: <6OFC1V9NYKU4.A4IIGF5S8XTL2@WIN-AUIR3RRGP88>

>> To: test-fig407g0q@srv1.mail-tester.com

>> MIME-Version: 1.0

>> Content-Type: multipart/alternative; boundary="=-uyqCBSDIg6SZbIUcrFxqTQ=="

>>

>> --=-uyqCBSDIg6SZbIUcrFxqTQ==

>> Content-Type: text/plain; charset=utf-8

>>

>> Test message

>> --=-uyqCBSDIg6SZbIUcrFxqTQ==

>> Content-Type: text/html; charset=utf-8

>> Content-Id: <6OFC1V9NYKU4.18DPBVYL2D7C2@WIN-AUIR3RRGP88>

>>

>> <b>Test message</b>

>> --=-uyqCBSDIg6SZbIUcrFxqTQ==--

>> .

<< 250 2.0.0 Ok: queued as 5F5FD146F78

I replace my IP address and domain with dummy details but this log i’m getting while sending email and check the screenshot, In screenshort you see it processing to send email and it process a long but email not send

I check with ports 465, 587 but email not send

Can’t send email without port 25 being open which I assume is the case by default at Amazon (as well as most other providers these days).

Without port 25 I can’t send emails??
Is there any way to send emails

If port 25 is blocked then I don’t use this port, why I can’t send emails using other port, is it due to prot 25 block no mail function will work?

I read an article just now that if port 25 blocked we can’t receive emails but we can send emails but in my case I’m able to receive emails but not able to send emails

Email servers listen for other email servers on port 25. If it was blocked, you wouldn’t get incoming email at all.

I"m not an expert but it seems curious that it gets queued. Do you see it in your mail queue?
https://yourservergoeshere:10000/postfix/mailq.cgi?xnavigation=1

If it isn’t there it was process and ‘dev nulled’ somewhere.

Also,
grep B565D /var/log/mail.info

or some other fragment of the message ID shown. That should give more.

Most cloud providers these days will block port 25 outbound to decrease the level of spam coming from their network. In most cases you will need to open a ticket to get it opened, maybe provide some info on how/what your spam policy is and some require you to have an active service for at least one billing cycle.
Talk to your provider and ask, they are the only ones that can help you directly with this.

The other option is to use a relay service, such as MailChannels, Sendgrid, SMTP2GO, mail.baby or similar (I’d recommend mail.baby as they’re run by good people, the same as the ones behind interserver.net, and the pricing is very fair).

I’m getting the emails but not it not sending, i check here “https://yourservergoeshere:10000/postfix/mailq.cgi?xnavigation=1” and found status all emails are in connection timeout or some of them are in Network is unreachable, This status i’m getting
Can you help me on this how to fix it?

You don’t control the rest of the world. You can’t tell every SMTP server in the world to listen on a different port. Port 25 is the SMTP port. If you don’t have port 25 (and you don’t on most major cloud providers), you don’t have a mail server.

You’ll need to use a relay service. This is documented at Amazon (and at every other major cloud provider).

Amazon offers a relay service: How to send an email – Amazon Web Services (AWS) (You need the SMTP interface, generally speaking: Using the Amazon SES SMTP interface to send email - Amazon Simple Email Service)

But, many other providers offer SMTP relay services.

This indicates there’s some hoops you can jump through the send mail directly from an EC2 instance: ruby on rails - Send emails from AWS EC2 instance (SES mandatory?) - Stack Overflow

But, there are benefits to letting others solve the deliverability problem. It’s probably that any IP you get at Amazon will be burned from previous abuse, and so you’ll find yourself blocked by at least a few mail servers until you jump through whatever hoops are needed to get unblocked (getting off of DNSBL/RBL lists, or contacting the server owner directly via whatever form they provide…it can be quite time-consuming, takes days or weeks to get through the Microsoft process, for instance, and you may have several to deal with).

Got it buddy so only option is left need to contact with AWS to remove this restrictions, and I don’t think the support will remove this as I want to send an bulk email. Okay let’s see thankyou @toreskev @ID10T @Joe for help me out from this situation

spammer eh :slight_smile: They let a few in as I get spam from there network.

Not spamming all of the emails is of my newsletter subscribers, We can’t say this is spamming something

You’ll want to use one of the many mail relay services. Maintaining deliverability for a mail server that sends a lot of mail is a challenge, even once you get it going. People mark stuff spam even if they subscribed to it, rather than unsubscribing (even if it’s easy to unsubscribe), and so you end up in a constant battle to maintain reasonable delivery.

Anyway, that’s what we do for the forum and our website notifications. It’s not wildly expensive (about ten bucks a month for all of our outgoing mail, and we send about 15k mails every month). We’re using Mailgun, but there are many, and probably some cheaper. I think Amazon’s service would be quite a bit cheaper, actually, but it didn’t exist when I set all this up.

smtp2go is free for less then 1000 per month btw, but get expensive after that.

I believe Amazon runs an external firewall on you instance. You do have the ability to open and close both incoming and outgoing ports. Been a while so I don’t remember the specifics.

Ya I know thanks for your suggestion, I think Amazon is best fit for need

Yes i did open and close the required port but by default the port 25 is disabled in Amazon EC2 and there is no option to open that port

If you have some inbounded rules details to open specific port that works for me. Let me know it helps me a lot. Thankyou

Got it but at this time I don’t wanna go tho other services provider I want my own SMTP server

I have a low end instance just for DNS. I just looked at the interface. (I use ‘Lightsail’. It seems it is only for inbound traffic. Not what I remembered but it has been months since I set it up.

EDIT: I forgot that I had a Discourse instance running as a test bed. I just tried password reset and got an email. I don’t remember having to set up anything with Amazon to get those emails out.

Also, AWS has their own internal forum for users.

Well your between a rock and a hard place