problems sending emails via smtp - smtp

i have an application that uses SMTP to send emails from an yahoo account. it worked fine one week ago, but now i'm getting this error "An existing connection was forcibly closed by the remote host." (the code is written in ffish but i don't think that's relevant since it worked last week without modifications). what should i do to make it work?

Contact Yahoo. It sounds like php is connecting to the SMTP server correctly, only the SMTP server is refusing your connection, possibly due to the server IP being flagged for spam.

Related

I am running out of SMTP Relays thrice in a week on my VPS running CentOS 6.6

I have a VPS purchased from godaddy runs CentOS 6.6 and I have more than 150 Joomla websites hosted onto this. I have maximum smtp relays alloted from godaddy that is 2000 for now. I am running out of SMTP relays due to some php scripts sending out emails alot and my email queue has lacks of emails to be sent. Earlier, I was also receiving many emails to the address like abc#xyz.com where xyz.com is hosted on my server but abc is not a user/email. In this case my server was sending bounce backs which was utilizing my relays. I have resolved this issue by rejecting such emails for which user is not availabel at the time of smtp check. This solved the problem a bit. But now, everyday a new php file send lot of emails out and utilizes all of my smtp relays. I delete such files everytime I detect this issue but there is not any permanant solution I got yet. Anybody please help me stop this at server level, not for particular website.
You can resolve this issues by disabling php mail function on your server and For the site mail, you will have to use SMTP authentication for your all site so that no one can send mail using any scripts.

Sendmail Postfix long delays

I am using PHP's mail function to send messages to the users of an application.
But I have been getting reports that some people don't receive them, and that others have arrived up to a couple of hours later.
So I was looking through /var/log/maillog, where I came across this message a lot:
postfix/smtp[22966]: connect to mx1.hotmail.com[65.55.37.104]:25: Connection timed out.
There were a lot of delays over 1000 sec in the log.
I have checked the firewall settings, and there are no rules stopping port 25, and this problem is not consistent, some emails go out fine, while others are sent with a long delay, and others are not sent at all.
Any suggestions for what to try next?
Running on CentOS 6.5.
From what you describe, it sounds like some of the remote mail servers that you are sending to could be greylisting your mail server, perhaps because it thinks that your mail server could be a spammer.
To see if your mail server has a glaring problem that would cause other mail servers to think it's a spammer, try sending a message from your mail server to check-auth#verifier.port25.com. This service will do a bunch of checks, and you'll get a report back with ton of information, such whether or not your mail server's DNS is setup correctly, whether your mail server's IP is on any black lists, if you have a problem with your SPF records, etc.

Setting up SMTP mail server. Done with installing SMTP. Now what?

I want to host my own mailserver using my own domain. So far I can see that SMTP needs to be installed and the DNS record has to be modified to point to my mailserver. So far so good. But what about mailaccounts? How do I create mail#mydomain.com with username and password so I can start receiving emails in outlook?
What more does it take to be able to receive mails in outlook now that im done with installing SMTP on my server?
Installing just the smtp service isn't going to get you what you need. In order for users to get their mail you'd need a pop server, or an IMAP server or and exchange server.
What you need is a seperate mail hosting package. Something like Imail from Ipswitch. Or exchange from Microsoft.
SMTP is simply a mail transfer mechanism, it will receive emails for remote SMTP servers and then try an deliver them. It does not handle mailboxes or email accounts, for this you will need a POP3, IMAP or Exchange server.

Are SMTP relay requirements for System.Net.Mail different than System.Web.Mail

I deployed my web app to our production IIS 6.0 server and everything is working except when my code attempts to send email to an address that is NOT in the domain of our email server. I've seen various symptoms but this seems the most straightforward to describe:
Syntax error in parameters or arguments. The server response was: 5.7.1 This system is not configured to relay mail
My web app getting this error msg uses System.Net.Mail. It resides along with the older web app it is supposed to replace which uses System.Web.Mail. There is one SMTP server on this same machine that seems to require some new configuration regarding relay.
Checking the SMTP server properties showed nothing configured for "Relay Restrictions". The older production web app sends email without errors with the SMTP server configured as described.
So, in summary, does use of System.Net.Mail require something different for relaying email than System.Web.Mail?
The web.config for the newer version that has relay issues contains:
<system.net><mailSettings><smtp><network host="mail.cbmiweb.com" port="25"/></smtp>
I used the values above for all my testing (first on my localhost with XP IIS 5.1; then on a staging IIS 6.0 server in our LAN) and never had any "relay" problems.
The web.config for the older version using System.Web.Mail contains nothing related to SMTP!
If I suddenly need a username and password added to the smtp setting above, how come I never needed "credentials" during development?
I don't know much about SMTP and really don't even know what to ask the mail server administrator. I am very confused about what to do...thanks.
Sounds to me like the old app is sending the message directly to the recipients server and is bypassing your local mail server completely. This would have happened because your app would not have had a mail server to use configured, so it defaults back to trying to send the mail itself.
This is usually a bad idea as it can cause delays in your application depending on the recipients mail server configuration (we're talking seconds here). Further if you aren't configured to deal with things like grey lists, etc, then you can have a high number of emails that you think was sent, but never really arrived.
You should ask the mail server administrator to properly configure your local mail server to allow relaying from your machine.
OR (and this is the more secure way)
You should set up a user on your local mail server and have your app use those login credentials when attempting to send email.
The systemnetmail.com site might be helpful. Specifically the page on smtp configuration.

Using gmail as SMTP server in Java web app is slow

I was wondering if anyone might be able to explain to me why it's taking nearly 30 seconds each time my Java web app sends an email using Gmail's SMTP server? See the following timestamps:
13/04/2010-22:24:27:281 DEBUG test.service.impl.SynchronousEmailService - Before sending mail.
13/04/2010-22:24:52:625 DEBUG test.service.impl.SynchronousEmailService - After sending mail.
I'm using spring's JavaMailSender class with the following settings:
email.host=smtp.gmail.com
email.username=myaccount#gmail.com
email.password=mypassword
email.port=465
mail.smtp.auth.required=true
Note that the mail is getting sent and I'm receiving it fine, there's just this delay which is resulting in a slow experience for the application user.
If you know how I can diagnose the problem myself that would be good too :)
It might be that gmail uses this delay to prevent spammers from using their SMTP server from the "outside": if the SMTP is called from the actual webmail client it would not use this delay.
In order to test this, you could open a telnet session to port 25 and do a manual SMTP session
(Search the web for SMTP HELO for examples)
GMail uses SSL for connection. To validate SSL certificate properly certain time is needed. Exact time depends on complexity of the certificate chain and use and accessibility of CRLs and OCSP checking. It's very likely that Java checks OCSPs for the certificate(s) presented, and this can be slow.
Try running your application on different system (preferably in other subnet) to exclude influence of firewalls. Maybe some part of communication (either SMTP itself, or CRL retrieval or OCSP checking) is slowed down by the firewall.
Depending on your OS, you should have a proper mail system that takes care of actually sending mails outside your network.
For instance, Postfix can do the job nicely. The configuration of Postfix would be on another thread, but typically Postfix would accept mails from your LAN (accepting to be a relay for your LAN) and would transfer the mails to gmail.
This is a exemple as to how setup postfix to have gmail as relay.
Having a mail service taking care of the relay of Gmail mails allows your Java application to be freed almost instantly (Postfix absorbs the mail, store it in its queue and forward it to Gmail itself).