I'm configuring RoundCube on my server and I'd like to use secured protocols for send/receiving mails.
When installing RoundCube, it asks me for ports for smtp and imap, I chose 465 and 993 but when I run the tests it freezes and I get a Gateway Time-out 504 error.
If I use port 25 and 143, it works!
Is there something to do with nginx/php-cgi to use those protocols?
Thank you.
I found what was wrong. If TLS or SSL is used you have to prefix the hostname with tls:// or ssl://, that was in the doc.
Related
Hi I setup a contact form for my website with following configuration using Laravel framework
MAIL_DRIVER=smtp
MAIL_HOST=smtp.netregistry.net
MAIL_PORT=465
MAIL_USERNAME= example#domain.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=ssl
MAIL_FROM= example#domain.com
MAIL_NAME= name
the above config works fine in my localhost, however when I tried in live server it gives me error
Connection could not be established with host smtp.netregistry.net [Connection refused #111]
I tried to fix it by changing mail server to smtp.gmail.com and even tried port 25, 465, 587 for encryption such as ssl, tls, startTLS none of them worked.
So I contacted hosting providers and asked for help and after 12 days of my struggle to get them address my issue finally come up with
our cloud infrastructure does not allow external smtp connections from our hosting. This means that if you are sending emails from your website you will need to use localhost as the smtp host setting.
so now I tried to change my MAIL_HOST to localhost which gave me error
Connection could not be established with host smtp.netregistry.net [Connection refused #0]
and now they were suggesting something wrong with my script. Any suggestions
That is complete BS from your host. First thing, it's common for cloud systems to block OUTGOING SMTP, as it's a spam prevention measure, but your script is fine. Your host may be blocking everything but port 80, which means you can't connect to an SMTP host at all. You may be able to use localhost by not using SMTP at all, and use the builtin mailer(sendmail is common).
Change MAIL_DRIVER=smtp to MAIL_DRIVER=mail to use php's built in mailer. This may solve your problem, if not, then you should seek other hosting arrangements.
my wordpress site email goes to Spam with php function,some site offer me using wp-mail-smtp plugin will repair my problem, but it doesn't help me!
when I use php mail() function my emails goes to spam
and when i use SMTP, i have an error like this: SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
i use this settings for smtp (in wp-mail-smtp plugin):
From Email: noreply#mydoamin.com
SMTP host: smtp.gmail.com
SMTP port: 465
Encryption: Use SSL encryption
Authentication: Yes: Use SMTP authentication
Username: myEmail#gmail.com
Password: mypassword
this settings give me an error!
note: i use captcha code and my server tell me port 465 is Open!
how can I send email in my wordpress site ?
A connection timed out means that the connection isn't going through. This could be your host, since I just checked your settings - they look OK!
I would look into contacting your host with this. For all I know, that's all you can do, unless you are going to use a 3rd party mail API.
A connection timeout means your host is dropping your outbound request to Gmail. You'll need to send your Gmail out on the HTTPS port using a WordPress plugin called Postman SMTP.
I have troubleshooting with sending emails at 1and1 hosting.
I use swift mailer lib message I receive is stream_socket_client(): unable to connect to mrvnet.kundenserver.de:0 http://mrvnet.kundenserver.de:0 (Connection timed out).
Does anyone have similar troubles? Any solution?
PS. At my localhost everything is OK.
I fix SMTP after contact with their support team.
SMTP parameters:
HOST: mrvnet.kundenserver.de
PORT: 25
AUTH: without auth
Contacted support, they asked me do not use encryption (neither ssl nor tls, both not acceptable), so my options are:
host: smtp.1and1.com
port: 25
login: somemail#somedomain.com
passwd: somestrongpassword=)
as you may mention i use 1and1's mail (same settings for gmail would not work)
Im having trouble being able to send an email. I've tried using Yahoo and Gmail but it seems to be on my end where there isn't a port to send emails from. Do I have to ask my ISP to open up a port on my connection or do I have to open up a port on my machine or the server and if so could some one give me the step/directions to open up a port on my machine or on the server. I have a server which I connect to the internet through so I am on a local machine in the network. Im using PHP to try and send email. I tried configuring my php.ini file but i get an error:=
Failed to connect to mailserver at "localhost" port 587, verify your
"SMTP" and "smtp_port" setting in php.ini or use ini_set()
in C:\wamp\www\buyme\views\forms\register_form.php on line 226
line 226 is where i send an email the default mail($to, $subject, $message, $headers);
Do I need to download and install something else for it to work?
Windows does not have sendmail functionality so its only option is to use SMTP to send mail via another mail server.
Assuming you have the mail settings configured correctly for the mail server you are trying to use. You may depending on your network, be restricted from sending traffic out on the smtp port in use. To verify this, use command prompt and try to open a telnet connection to the mail server on the specified port. You should see some sort of hello message if this works. If not, you may have a firewall somewhere blocking you.
Some SMTP servers require TLS/SSL when sending mail. I'm not sure if PHP supports this with the base mail command, but other mail libraries can be used instead.
Check your hosting's registration email which includes ftp settings, login settings etc. whether there's any information about a SMTP server which you can use in your application. If not, ask your hosting provider if any SMTP service runs on your hosting. If any, ask for it's settings. Maybe there's a different port/security configuration that you don't know.
My ISP have blocked port 25 for sending mails from PHP, and instead have allowed port 587 or 465 to be used. how do i force php mail function to use port 587 instead of default 25? BTW : i am on OSX 10.6.6 using MAMP PRO
UPDATE : i tried changing the settings in php.ini to this
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 587
as i am on mac i don't think this can be the solution for me, and it is not working after i tried. it gives me following error message.
May 6 20:32:25 Ibrahim-Armars-MacBook-Pro postfix/smtp[2822]: connect to alt2.aspmx.l.google.com[74.125.159.27]:25: Operation timed out
May 6 20:32:25 Ibrahim-Armars-MacBook-Pro postfix/smtp[2823]: connect to alt2.aspmx.l.google.com[74.125.159.27]:25: Operation timed out
May 6 20:32:25 Ibrahim-Armars-MacBook-Pro postfix/smtp[2827]: connect to alt2.aspmx.l.google.com[74.125.159.27]:25: Operation timed out
May 6 20:32:25 Ibrahim-Armars-MacBook-Pro postfix/smtp[2825]: connect to alt2.aspmx.l.google.com[74.125.159.27]:25: Operation timed out
May 6 20:32:25 Ibrahim-Armars-MacBook-Pro postfix/smtp[2828]: connect to alt2.aspmx.l.google.com[74.125.159.27]:25: Operation timed out
you see it is still trying to connect via port 25? how do i change it in mac?
Changing smtp_port only affects how mail() interacts with the server specified by SMTP setting. This isn't the issue. The issue is that:
You are using your local machine as the SMTP server - AND
Your ISP is blocking your local SMTP server (postfix) from relaying messages out to Gmail
First, read this thread. It discusses the same exact issue. The upshot is that you need to use a different mail server, preferably your ISPs mail server. What server and port does your ISP tell you to use for outbound mail if you want to use their Email services? You should be able to use this from your PHP running locally just like you would an email client like Thundebird - and you will be able to send to Gmail.
Set smtp_port = 587 in your php.ini. See http://php.net/manual/en/mail.configuration.php
EDIT
As AJ noted, this won't fix the problem if you're using your local postfix or sendmail, which you do by specifying smtp = localhost. Try setting that to your ISP's SMTP server address instead.
That might lead to the next problem if they also require authentication before allowing you to send mail, which many ISPs do. In that case, your best bet would be the Pear Mail package. That will incidentally also allow you to specify the mail server and port in your script. From the documentation:
$params["host"] - The server to connect. Default is localhost.
$params["port"] - The port to connect. Default is 25.
$params["auth"] - Whether or not to use SMTP authentication. Default is FALSE.
$params["username"] - The username to use for SMTP authentication.
$params["password"] - The password to use for SMTP authentication.
You can edit your php.ini file (if you have access) and set smtp_port = 587 or in your code, ini_set('smtp_port', 587).
If you can, try to override smtp_port setting with ini_set().
Should be something like this:
ini_set('smtp_port', 587);
For those of you using MAMP and not able to send the mail from php mail() function because of port 25 being blocked by ISP (in my case) here is some information for you to solve it. as OSX uses postfix to send mails and if you plan to use external smtp server like smtp.gmail.com which i used here is what you should be doing. you need to configure Postfix to use Gmail as a relay host
a) Open MAMP and in postfix change the domain of outgoing mail to smtp.gmail.com
b) open terminal and type sudo vi /etc/postfix/main.cf this will ask for your admin password enter it and it will open main.cf in vi editor
c) press ctrl+f and come to the end of the file and bring the cursor one line down from the end and press a , the editor will now switch to insert mode to edit the file.
in main.cf append this settings
relayhost = [smtp.gmail.com]:587
smtp_tls_security_level = verify
#smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
press :wq to exit vim. Back in the shell type sudo vi /etc/postfix/sasl_passwd and enter the following (substitute your gmail address and gmail password):
[smtp.gmail.com]:587 user#gmail.com:mypassword
again press :wq to save and quit the file, and run the following command
sudo postmap /etc/postfix/sasl_passwd
sudo postfix reload
hope this helps someone with the same problem which i faced.