Exchange SQL Server 2008 Database Mail issue - sql-server-2008

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.

Related

Msmtprc SMTP with Office365

I am configuring msmtprc smtp to send an outbound email and having a trouble with office365. It's working fine with Gmail account, but I am getting the following error with office 365.
msmtp: authentication failed (method LOGIN)
msmtp: server message: 535 5.7.3 Authentication unsuccessful [BN6PR13CA0016.namprd13.prod.outlook.com]
msmtp: could not send mail (account default from /etc/msmtprc)
/var/log/msmtp.log
Authentication unsuccessful [BN6PR13CA0016.namprd13.prod.outlook.com]' errormsg='authentication failed (method LOGIN)' exitcode=EX_NOPERM
/etc/msmtprc
defaults
auth on
logfile /var/log/msmtp.log
account office
host smtp.office365.com
port 587
protocol smtp
from support#example.net
user support#example.net
password *******
tls on
tls_starttls on
tls_trust_file /etc/pki/tls/certs/ca-bundle.crt
Does anyone successfully use Msmtprc with office365?
Thank you.
I've been successfully using msmtp fine for quite some time, using the following settings (on a CentOS 7 box), but with the config in $HOME/.msmtprc since it's just for my user rather than globally:
account default
host smtp.office365.com
port 587
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
tls_certcheck on
auth on
user username#example.com
passwordeval pass office365.com
from username#example.com
logfile ~/.msmtp.d/msmtp.log
..so this is 99% the same as yours except that instead of having the password in the file I'm using passwordeval to provide it via the output of the given command.
Perhaps multiple spaces between password and the password itself is causing the spaces to be added to the start of the password?
You could also try running msmtp so that it has a controlling terminal (i.e. run from the shell rather than via the service manager as with systemctl) to test whether providing it the password that way works as expected?

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.

Sending test mail fails in confluence

I need to evaluate notification functionality in confluence.
I have installed confluence locally on my PC.
I have configured mail server in it by going to General Configuration->Mail Servers->Add a new SMTP mail server
I have provided smtp.office365.com as Server Host Name and 587 as Server port.
I have used my company user id as User name and corresponding password.
However when I try to send a test mail, it fails with below exception
"Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 587" and also we have tried to configure our smtp server and getting error as "Caused by: java.net.SocketException: Permission denied: connect"
I have seen accepted answers for this question at post https://answers.atlassian.com/questions/139025/error-while-configuring-mail-server
However that is related to a bug Java1.7 whereas I am using Java1.8.
Can someone please suggest any idea what thing can be wrong?
Looking at the hostname it seems that the mail server is in the internet. If you are behind a proxy you will need to configure this in the java options as described here
https://confluence.atlassian.com/doc/configuring-web-proxy-support-for-confluence-117068.html

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.