Access Gmail's email without imap or pop3 - php

I have a problem, i have developed a code to access Gmail's email via imap but most of online server don't allow opening of port 993 even on dedicated IP which is necessary for imap. I am confused,
How to access gmail's email without imap
What's online server mean when they say they support imap but don't allow to open port 993. How imap can be accessible without opening port 993.
Any alternate solution is appreciated.

If your hoster blocks outgoing TCP connections to port 993, I would suggest to switch the hosting provider. There's plenty of companies which offer uncrippled service.

Try IMap non ssl port 143.
imap_open( "{server.example.com:143/novalidate-cert}INBOX" , 'login' , 'password' );
Thanks

Related

smtp.gmail.com vs ssl://smtp.gmail.com while sending email using gmail smtp server

According to this
Gmail SMTP Server could also be used to relay messages from your
device or application. You can connect to Gmail mail servers using
SMTP, SSL/TLS. If you connect using SMTP, you can only send mail to
Gmail or Google Apps users; if you connect using SSL/TLS, you can send
mail to anyone.
If your device or application supports SSL - connect to smtp.gmail.com
on port 465.
So I tried connecting to smtp.gmail.com on port 465. I got the following error:
Unable to send email using PHP SMTP. Your server might not be
configured to send mail using this method.
Some code uses another address "ssl://smtp.gmail.com".
When I use ssl://smtp.gmail.com also on port 465, my application now works correctly.
What's the difference between ssl://smtp.gmail.com and smtp.gmail.com if the latter also uses ssl?
Why can't we send emails to other domains without SSL? Is this only done by gmail for security purposes?
I am extremely new at this. Can anyone explain? I am using php if it matters.
The difference between the prefixing the hostname with ssl:// and without it is whether or not the underlying stream will be wrapped through OpenSSL, or speak in plain text.
When you connect to Gmail on port 465, it expects the client will use TLS encryption. Most likely, the error message you were seeing was a general result of connecting to a service expecting an encrypted connection when it was just trying to write and read data in plain text.
PHP does magic for you when you use the ssl:// wrapper to connect to a service that supports TLS or SSL. It allows you to read and write on the stream (using say fread/fwrite) in the same manner you would on an unencrypted connection and all the handshaking, encryption, and decryption is done in the background having to do no more than prefix the host with the ssl wrapper.
As to the second question, it is most likely security related. In order to relay (send mail to another domain) you need to authenticate over SMTP which should NEVER be done in cleartext while you can connect on port 25 using an unencrypted connection and send mail to a Gmail user without authenticating (this is what most outside mail servers do when one of their users which to send mail to Gmail). But technologically, there's nothing preventing them from allowing you to send mail using an unencrypted connection, or even authenticating with Gmail credentials (this is called an open relay and is usually badly abused by spammers).
You can learn more about your first question by just reading about the SMTP protocol, the STARTTLS command, and TLS encryption in general. STARTTLS allows a client to connect to the mail server over an unencrypted connection and then negotiate (upgrade) the connection to use encryption, where on the other hand, connections to port 465 expect a TLS handshake to occur as soon as the connection is established and before any protocol (SMTP) communication occurs.

Error connection mandrill (Laravel)

I have an issue with the mandrill API, I got this message :
Failed to connect to mandrillapp.com port 443: Connection timed out
It's works on my production server (ex mysite.com), but not on my dev server (ex mysite.com:8080).
The two servers have same config by the way.
Anyone knows why I got this issue ?
Thanks !
Make sure your hosting provider or internet provider (ISP) allows
outbound SMTP connections. Some shared hosting providers only allow
outbound SMTP connections on dedicated servers, while others block
them completely. In some cases, hosting providers might redirect the
connection, so instead of connecting to smtp.mandrillapp.com, you
connect to their local server instead.
Make sure the port you've selected is one that your hosting provider
or ISP has available for outbound SMTP connections. Some hosts block
all connections on port 25, for example, so you can try using a
different supported port.
Double check that you're using a valid API key to connect via SMTP,
and not the password that's used to log in to Mandrill's web
application.
If you're using Postfix, make sure that you have an SASL library
(like libsasl2 or cyrus) installed and that it's up to date.
Otherwise, you may be connecting but not passing authentication
credentials.
For other SMTP libraries, make sure you're using LOGIN or PLAIN
authentication methods.
Once you've confirmed all of the above, if you're still seeing issues,
please enable additional logging in your SMTP program or library. If
you're using an integration, contact the integration developer for
information on configuring logging of the SMTP conversation.
Where do I find my SMTP credentials?
After you create a Mandrill account, get your SMTP credentials on the
SMTP & API Info page in your account.
The SMTP password is any active API key for your account, not the
password used to log in to Mandrill. The credentials list port 587,
but any port supported by Mandrill will work, and there's no
configuration change needed within Mandrill to activate one of the
alternate ports.
Which SMTP ports can I use?
You can use port 25, 587, or 2525 if you're not encrypting the
communication between your system and Mandrill or if you want to use
the STARTTLS extension (also known as TLS encryption). SSL is
supported on port 465.
ISPs may redirect traffic on certain ports, so it's up to you which
port you use.

SMTP Traffic on port 25

What are the dangers of opening port 25 to allow smtp traffic through? I have a windows server 2003 box which has port 25 blocked (Not by ISP), I know ISP's for usually block this port from use but as I need it for some php scripts I'm running that notify users by email, Is there any dangers or precautionary actions I should take?
Any advice would be appreciated,
Thanks Luke.
If you are thinking of unblocking port 25 on outbound traffic then no, not really. If you are wanting unblock port 25 on incomming traffic to receive email from external scripts into your internal mail server then you need to ensure you have the mail server configured to prevent relaying etc.

GAE Sending emails via SMTP

Reading up on GAE as a possible alternative to dedicated hosting (or VPS)...
Seems I would need to re-write a bit of code, if I had modules which relied on SMTP. Does this mean that even if I connected to a remote SMTP server that code would need to change to an HTTP API (assuming one is even provided by an third party SMTP provider such as smtp.com).
Yes - AppEngine/PHP does not yet support sockets and thus you can not connect to external SMTP servers. Also, even with sockets you would not be able to use SMPT on port 25, but authenticated SMTP on port 587 - see socket limitations.
OTOH, you can send email from AppEngine via the Mail API.
If you still want to send email via an external mail provider, you need to choose one that supports HTTP API, for example Amazon SES.

Send Mail from GMail with PHP; over proxy

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?

Categories