Sendmail is unable to send letters to the internet (only local mail is being sent) - centos

I'm using centos 5 and sendmail on intranet server. Local mail is being delivered perfectly, but when i try to deliver email to gmail, for example (or any other service outside intranet) i find following errors in my logs:
Jan 16 16:50:32 testlink sendmail[27713]: r0GCoVi5027711: to=<example#gmail.com>,
ctladdr=<webdev#testlink.ru.corp.domain.com> (502/502), delay=00:00:01,
xdelay=00:00:01, mailer=esmtp, pri=120332, relay=alt4.gmail-smtp-in.l.google.com.
[173.194.68.27], dsn=4.0.0, stat=Deferred:
Connection refused by alt4.gmail-smtp-in.l.google.com.
one more important thing - server is not accessible from internet, but i can access internet from my server..
Please advice where should i search the problem.. i understand that i should setup sendmail somehow (currently i'm using default configuration that was set by yum), but what settings (or at least direction)... Thanks in advance!

run ifconfig in command line. perhaps something is wrong with your IP
also look into iptables -L
netstat -nap should have a string
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5275/sendmail
check if provider blocks port 25:
telnet smtp.ukr.net 25

Related

sending mail to mailtrap.io

I am using Laravel 5.1
I made a contact page in my application. So users can send an email. Here I have used mailtrap.io
It works when I have created. I mean there was no problem to send mail to mailtrap.io
But today, when I was checking this again, It shows me this error.
Swift_TransportException in StreamBuffer.php line 268:
Connection could not be established with host mailtrap.io [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. #10060]
I have checked my .env file with mailtrap.io setting. everything is ok. Here is my .env file setting
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=[username]
MAIL_PASSWORD=[password]
MAIL_ENCRYPTION=tls
Anyone please help me?
Probably you have issues with port 25 being blocked by your provider or host.
You can verify this using telnet:
telnet smtp.mailtrap.io 25
If you get no response or a timeout, you can not use port 25.
Mailtrap allows you to use 2 other ports, 2525 and 465.
You can verify with telnet if those ports are working.
telnet smtp.mailtrap.io 2525
If that connects properly, modify your .env file to use 2525.
If you are using php artisan serve instead of homestead or something else, be sure to restart after making changes to your .env.
try
MAIL_PORT=465
instead of
MAIL_PORT=2525
like this
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
Update your composer by giving
composer update
and run your application.

Server Connection with public IP

I have setup a simple HTTP java server running locally on port 8000. It simply prints a message "Hello world" when a request comes. When I try to ping it from the browser by running http://localhost:8000/test I get my message printed.
I want to get the same results from another computer that is not local. When I try to use my public IP lets say http:/43.xxx.xxx.xxx:8000/test (even from the same machine) I get an ERR_CONNECTION_REFUSED .
I probably suspect that has something to do with the firewall. Can anyone guide me a little more because I lack the experience?
Thanks in advance
You don't specify what host OS your server/firewall is running so I'll keep this generic...
Without knowing your application, it seems like the server is sending a reset (RST packet) when the first SYN packet shows up indicating that the port (on that interface [your external]) is closed. You can do a quick port scan from here (https://mxtoolbox.com/PortScan.aspx) if you don't have access to a remote machine to test with. Odds are, TCP/8000 will not be open.
If it is, in fact, closed, you'll have to look at the firewall that your host OS is running and find out how to allow TCP/8000 to your host. In a major firewall vendor, your rule would look similar to this:
Source: Any
Destination: Your Public IP Address
Service: TCP/8000
Action: Allow
Logging: Full
That being said, you mentioned this was a PC so look into "iptables" (if you're running *nix) or the Windows Firewall (if you're running Windows) on adding firewall rules (Unfortunately I just joined and can't ask questions/comments, yet).
If you really want to find out what packet is being sent, run a tcpdump on your external interface (let's say eth1) (assuming your remote IP is 1.2.3.4 and your home public IP is 4.5.6.7):
tcpdump -nn -vvv -e -s 0 -X -c 100 -i eth1 host 1.2.3.4 and host
4.5.6.7 and port 8000
Here you're looking for the SYN/SYN-ACK/ACK for a successful TCP negotiation or SYN/RST if there is a firewall rejecting (not dropping) the TCP stream to the port.
Once the port is open on the host OS firewall, take a look at the application to make sure it's configured properly. If this were a standard webserver, you could take a look at the configuration files for the "Allow from" directives to make sure that everyone can access the site. If this is a custom application that you've created, you'll have to check this yourself.
I finally solved my problem. I needed to open a forwarding port in my router that maps my local ip address to the public. My router is TP Link so this what I did:
http://www.tp-link.com/us/faq-72.html
Also in order for this to work every time and not to have to reconfigure this every time I reconected to the router (because I get a new local IP), I have created a static local ip for my server following this guide:
http://www.tp-link.com/us/faq-182.html
Thanks for all the replies.

Force Exim to use ipv4 ip

I have an unmanaged VPS that runs CentOS 7 Minimal. I have installed Exim for sending emails. My main server IP is IPv4 and I have an additional IPv6 address.
Exim uses the IPv6 address to send emails. I want to overwrite this and use the IPv4 main server address. I added the interface line to the exim.conf:
remote_smtp:
driver = smtp
interface = x.x.x.x
And then restarted Exim but no matter what, it uses the IPv6 one. I thought that Exim is ignoring the config file but that's not the case as if I enter wrong IP format for interface and try sendmail, I get wrong IP format while sending email.
I tried adding disable_ipv6 = true to the end of exim.conf but when I saved and restarted Exim, I got the following error when running Sendmail: "Option disable_ipv6 unknown"
Thanks
I had this problem too, moved the disable_ipv6 to the begining of the config file and it was solved
root#hostname/etc/exim4 # service exim4 restart
root#hostname/etc/exim4 # exim -bP disable_ipv6
disable_ipv6

Can send mail but can't receive SMTP failure

I've got dedicated server to run all my sites from.
I created domain and updated all DNS records to this server, everything is fine and propagated however when i try and receive mail nothing happens but it can send.
I went to dnsstuff.com and this is the error i got...
All connections to Mailservers port 25 have failed. The standard port
for SMTP transactions is 25, so your servers should be operating on
that port. It is recommended that it be fixed in order for your mail
service to operate properly. The Mail Servers that failed are:
xx.xxx.xxx.xxx | failed message send with: failed cx open with: failed socket connect with: Operation now in progress
/*****************
UPDATE
*****************/
Running a linux box using centOS.
The mailserver being used is, I believe, Postfix.
How do i fix this problem?
Check your firewall configuration on your server. If you can send from localhost (that is, direclty from your server), but mail can't be delivered from remote servers to your box, your firewall is the best bet to look at. Basically port 25 should be open to any IP. It's hard to give you specific details on how to configure your firewall, as you do not specify your OS and dikstribution. Most Linux distro's run some flavour of iptables. If iptables is what you have, you could try this command from the command line:
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
Before you open up your firewall, you might want to dive into configuring postfix. It would not be nice to the rest of the world if you started running an open relay. That will get your server blacklisted in no time. This artice on the postfix website will give you a decent start.

Setting up hMailServer SMTP on port 2525

I currently have a working hmailserver on a windows server 2008 vps. My server currently listens on port 25 as usual. Since a couple of days now I've been having problems sending e-mails from hotels and weird isps that block port 25. I've solved this issue on non-vps servers by making my smtp listen on port 2525 as well.
The problem is that I don't really know how to make hmailserver to listen on port 2525. I've browsed the hmailserveradministrator options and searched on google but I can't find anything related on the subject.
Any ideas?
Thanks a lot!!
Hi you can make hMailServer listen on two ports at the same time.
Settings > Advanced > TCP/IP Ports >
SMTP, 0.0.0.0, 25
SMTP, 0.0.0.0, 2525