I am running a local apache server on an ubuntu machine, and i am trying to use the phpmailer class to send mail.
It tries to connect by fsockopen to the mail server, but it throws a timeout error. I tried setting the timeout to 15sec with no luck.
It does work on other machines.
How can i find out if my ISP has blocked requests ?
The mail server responds to ping.
ping and SMTP command don't go via the same port ; it is possible that one port is opened, and not the other one.
If there is a timeout, it probably means that :
either your SMTP server is not accepting connections from your server
or there is something somewhere (like a firewall) that's blocking your requests.
If you have an ssh access to the server, using telnet in command line to try to connect to the SMTP server, and send SMTP commands, might allow you to get some more informations...
Here a couple of links that show examples of an SMTP session via telnet :
Sending an e-mail via Telnet
Send mail through SMTP using Telnet
If you cannot connect to the server, maybe you'll get some error message (telling you that you are not allowed to connect, for instance), or it'll timeout again... Which probably means your request are being blocked somewhere...
In that case, check with your network administrator ; maybe he'll have some idea about opening some port on the firewall.
Related
I use Chilkat component with PHP multithreaded application.
$this->tunnel = new CkSocket();
// Here is connecting to ssh
$this->imap->UseSshTunnel($this->tunnel)
And this is how I use ssh to communicate with imap via ssh.
On the server I also have apache2 running. And the problem is if I open more threads - apache doesn't handle requests. I think maybe Chilkat uses 80 port and then there is conflict ?
But I tried to check busy ports with ubuntu commands and I did not see that chilkat opened ports. Does chilkat do it ? What may be the problem ? Or can I set to chilkat the ports which must not be used ?
This question may touch not only exactly Chilkat component, but sockets generally
For reference, here's the full example: https://www.example-code.com/phpExt/imap_useSshTunnel.asp
In the example, Chilkat is not listening at any port. In other words, Chilkat is not acting as the server-side of any connection. The 1st step in the example above is to establish a connection to an SSH server. The 2nd step is to have the IMAP client (Chilkat) use the existing SSH connection to establish the connection with the IMAP server. Instead of connecting directly (IMAP client to IMAP server) you are establishing the connection through a logical channel on an existing SSH connection. In other words, the IMAP protocol is tunneled through the SSH protocol. In other words, data sent from Chilkat to the IMAP server first travels through the SSH tunnel, then at the SSH server, the data completes its journey to the IMAP server over a regular TLS or non-TLS connection. (If a TLS connection is desired, then the TLS protocol itself is being tunneled through the SSH connection.)
I am sending mail in PHP, but I use a remote mail server.
I have three questions:
1) In my PHP mail code, should I use the server settings for the local mail server or the remote mail server and is there a difference?
2) If I use the remote mail server, won't the mailserver domain IP address not match the real domain's IP Address (potentially going to Spam folders)?
The problem I am having might be specific to my host, mail server, version, or mail plugin.
I am trying to use a plugin called Swiftmailer to send mail through my local mail server, which works on port 25 with no SSL. When I switch the port to 465 (per my host's recommendation) and change it to SSL, I get a refused connection. (I believe this is because I don't have SSL added to this server yet)
3) Does SSL really matter? Should I just use port 25 without SSL and save myself the trouble? (I care about security, not server requirements)
I'm building an internal web-application in PHP that needs the ability to mail.
I've used the code listed here:
Send email using the GMail SMTP server from a PHP page
and it works like a charm, when I run it from my house. However, when I run the code from the office, I get the following:
Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: 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. (code: -1, response: )]
Any idea how to get around this?
Thanks,
-JWW
I agree with the responder above - this is most likely a firewall blocking outbound connections on port 465. You can either try TLS connection on port 587 or port 25 per Gmail's troubleshooting docs : http://support.google.com/mail/bin/answer.py?hl=en&answer=78775
If you are unable to get around this (if IT will not remove the blocks for example), you could try a third party API as a proxy. Our product http://PostageApp.com can use external mailservers such as Gmail, in addition to our own MTA, and communication is all through standard http REST calls, avoiding the firewall issue.
We're a paid service but have a free plan as well...if you would be sending more email than our free plan allows for (100/day), then you'll probably fall foul of Gmail's sending limits anyway which restrict third party clients to about 100/day outbound.
http://help.postageapp.com/kb/quick-start-guides/php
Disclaimer: I work for PostageApp
It's most probably a firewall at your workplace blocking outgoing connections to port 465. Did you try port 587 instead?
I am working for a client who bought a server (V-Server from Strato) with IIS. I've set up a SMTP Server so I can use "mail()" from php to send mails. But everytime I am trying to send a mail, it tells me to configure my SMTP server.
I already added realys, new domains and restarted the whole thing. What can I do? I want to send them from the localhost because the server is running on the machine itself.
First of all, you need to check your mail server (SMTP Server) to confirm it is working properly. To check it manually try telnet 25 port of localhost and execute basic SMTP command to see if it accept mail relaying from your localhost. Microsoft has an article on SMTP check with telnet client, have a look if needed.
If your SMTP server is working as expected, then try debugging your php coding.
FYI: No comments privilege, had to write this as answer...
I'm using PHPMailer to send out site contacts.
In development, the script works perfectly with the GMail service over smtp. However, in production, inside the client's DMZ, it appears unable to connect to the SMTP service they have there. I have connected to the same service using telnet to port 25, so I know for sure it exists and is available to the server.
Are there any circumstances where php might not be able to open a socket connection (fsockopen)...? The php extension openssl is loaded and ok.
The error is "Unable to connect to SMTP service".
Thanks!
If the same code works elsewhere on the same OS/webserver/PHP, then its nothing to do with the PHP code. Indeed you say:
inside the client's DMZ, it appears unable to connect to the SMTP service
This rather suggests that its a configuration issue on the production network. If you can get shell access to the srver, try telneting to port 25 on the SMTP server - I'll bet it doesn't work.
If there's a long delay in getting back this error message then it might be a DNS issue rather than a firewall/routing issue.
C.
This was resolved, turned out to be an authentication issue. Hooray for finally being able to talk to the network administrators!