Integrating SendGrid - smtp

I'm trying to integrate SendGrid in the MVC application.
It is using the port 587. and SSL is enabled
Host = "smtp.sendgrid.net";
When I try to send an email, it is throwing :
System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 159.122.224.196:587
Message : Failure sending mail.
Also when I ping smtp.sendgrid.net, it is using the IP 159.122.224.197

Do you have a firewall/antivirus application running on the machine that is blocking outgoing requests on port 587? If so, add a rule to allow outgoing requests on port 587.

Related

Failure Sending Mail using GSuite SMTP

I have a very curious issue with an application. When debugging locally, I can send emails just fine using a client's G Suite email credentials:
<smtp deliveryMethod="Network" from="client#customdomain.com">
<network defaultCredentials="false"
host="smtp.gmail.com"
port="587"
userName="client#customdomail.com"
password="supersecret"
enableSsl="true" />
</smtp>
Now, it's very important to note that the application will send just fine with the credentials when running on localhost using Visual Studio. However, when deploying to LIVE and using the exact same credentials, the application refuses to send and I only get the canned response back saying "Failure Sending mail".
I have enabled "less secure applications" in the settings and have verified the "suspicious activity" from the server's IP address. I can also log in to the Gmail account from the server using RDP and opening Firefox to go to Gmail.com.
No firewall rule has been set to block SMTP or anything on port 587.
UPDATE: the materialized error message is
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 74.125.192.108:587
74.125.192.108 being smtp.gmail.com's IP Address (or one of them, at least)
UPDATE 2: I can also not get Thunderbird on the remote server to send an email using the supplied credentials, however it can connect via IMAP and download the contents of the inbox just fine.
Well in this very specific case, it was the fault of the Amazon infrastructure this application ran on. Either amazon themselves, or the reseller changed a policy that ended up blocking communications on ports 465, 587 and 993 (and probably others too).
The "solution" was to nag them to sort it out.

Prestashop SMTP Connection could not be established with host

I am having a problem configuring Prestashop SMTP.
I am trying to use gmail client.
SMTP server: smtp.gmail.com
Username: xxxxxxxx#gmail.com
Password: password_of_gmail
SSL
465
Error:
Connection could not be established with host smtp.gmail.com [Cannot assign requested address #99]
Gmail has turn off 2 step vertification, POP3 enabled, and Allow less secure apps enabled too.
Maybe your server doesn't allow external SMTP access.
For example 1and1 shared hosting doesn't allow that https://github.com/PHPMailer/PHPMailer/issues/816

CDO failed to connect on ports 465 and 587 but works on 25

We have a legacy FoxPro application that uses CDO for NTS to send STMP email through our Exchange server. We have 3 locations: Local (app run on same domain as Exchange server), VPN (app run on external network connected to domain via VPN), External (app run on external network and connects via Internet).
Up to now, Local has been configured to use port 25 with SSL. VPN and External have been configured to use port 465 with SSL. (My understanding from our network admin was that Exchange couldn't be configured to do SMTPS on 465 and we had to use STunnel).
Recently, we made changes to our Exchange server to disable SSL and only allow TLS. We opened up port 587. So according to my network admin, we now have Port 25 & 587 using the same Exchange Receive Connector and are set to use STARTTLS. Port 465 has also been configured to use STARTTLS and uses a different Exchange Receive Connector; however, the properties are all configured the same as the one used for 25 & 587.
After this change was made, our VPN and External sites were no longer able to send email through the application. The error message they get is:
OLE IDispatch exception code 0 from CDO.Message.1: The transport failed to connect to the server.
So, here is the current state of things:
Local - can send on 25 but not on 465 or 587
VPN - can not send on any of these ports
External - can not send on any of these ports
I also tried using the same code and was able to send SMTP from our system through gmail on port 465 and port 25 but not 587.
This is getting way beyond me at this point and I really don't know where to go from here. Does anyone have any ideas as to what may be going on?
I used WireShark to try to figure out what was being communicated between my client and the server (this would be for the Local scenario). Here are some the results:
Exchange on port 25 (Worked)
Exchange on port 465 (Fail)
Exchange on port 587 (Fail)
Gmail on port 465 (Worked)
Gmail on port 587 (Fail)
We finally found a workaround in case anyone is interested. Our Network Admin installed STunnel on our Exchange server and configured it to watch port 465. This got everything working again.

Qmail SMTP server behind firewall configuration

i've a problem with configuration Qmail + SimScan + SpamAssassin (dovecot + RoundCube) with SPF plugin.
For Spf spam prevention, this system rejects all mail that don't passed SPF test with tool "spfquery" (read SPF explanation for understand my problem).
My Network configuration is:
NAT/Firewall: 10.0.1.1
MailServer: 10.0.1.2
Dns Server : 10.0.1.19
External IP: 212.212.12.12
All modules in my mail server works greatly, also network configuration.
Now i've problem with SPF-rejection or DNSBL, beacuse server IP for incoming mail is 10.0.1.1
Log for smtp server is:
CHKUSER accepted sender: from remote mx5.pippo.com:unknown:10.0.1.1> rcpt <> : sender accepted
qmail-smtpd: spf-reject: HELO(mx5.pippo.com) from 10.0.1.1 MAILFROM:info#pippo.com
Why my tcpserver see mail from 10.0.1.1 and not from mx record of pippo.com?
This is a bad configuration of my NAT or tcpserver/smtp server?
Intersting question. I think something is wrong with your config.
If I understand correctly, your MX record for your domain points to 212.212.12.12, which is the external IP of your router. You have port-forwarding setup on your router, to forward incoming connections on 212.212.12.12:25 to 10.0.1.2:25, which is the IP of your mail server on your private network.
If that's the case, your mail server should still see the connections from the remote IP that they are originating from, it should not look like the connections are coming from 10.0.1.1. Port-forwarding only re-writes the destination IP address on the packets, not the source address.
To confirm this, I did a test on a similar setup that I have at my house. I logged in remotely to a Linux box that I have running on my home network, on an inside IP behind by router, like you have. The Linux box did indeed see that I was coming from my remote IP address, not my home router's IP address.

Exchange SQL Server 2008 Database Mail issue

In my web application I have created a mail sender class and set the configurations of web.config file like this:
<mailSettings>
<smtp deliveryMethod="PickupDirectoryFromIis">
<network host="smtp.domain.com"
port="587"
userName="mail#domain.com"
password="password"/>
</smtp>
</mailSettings>
This is sending email. But SQL Server database mail can not send mail with the same account info.
Only one difference is PickupDirectoryFromIis .
Is there any setting on exchange server?
In the SQL Server Logs the errors are following.
Message
The mail could not be sent to the recipients because of the mail
server failure. (Sending Mail using Account 2 (2012-09-30T16:55:04).
Exception Message: Cannot send mails to mail server. (The SMTP server
requires a secure connection or the client was not authenticated. The
server response was: 5.7.1 Client was not authenticated).
Looks like this is a Authentication issue or port no issue.
Authentication Issue:
—————————-
Please make sure you have put the information as explained below:
Server name: smtp.gmail.com ( this is really important)
port no: 587 ( on many website this is given as 465 which is wrong, use 587 )
Check : This server requires a secure connection
Check Basic Authentication
username: youremailid#gmail.com ( should have gmail.com)
password: XXXXXXXXXXXXX
confirm password: confirm your password
Port No Issue:
——————–
Make sure port 587 is opened in your machine if you are following above example. If you are using any other port number (usually its port 25) to set up database mail in your office, make sure you speak with your security team and ask them to unblock port 25. Once they unblock port 25, your databasemail will work.
Network Connectivity:
—————————–
Also check network connectivity from your machine, if you can connect to internet from your machine on which you are testing your database mail. To test, do the following
Start- Run- type cmd – Hit Enter
Type ping gmail.com -t and then hit enter.
If output displays as Request timed out, it actually means there is network connectivity problem. Otherwise, your network connectivity is good.