Última atualização em 5 de Março, 2021 por Vítor Fernandes.
Em redes de computadores, uma porta é um ponto final de comunicação. No nível do software, dentro de um sistema operacional, uma porta é uma construção lógica que identifica um processo específico ou tipo de serviço de rede. Os protocolos mais comuns que usam números de porta são TCP (Transmission Control Protocol) e UDP (User Datagram Protocol).
wikipedia
Para não repetir o acesso, verifique as portas existentes através do painel do Firewall do Windows. Se existir, remova-os antes de executar o código abaixo!
Abre o painel do Firewall do Windows
Remove as portas existentes e evite duplicação de dados
wf.msc
Abrir porta 80 (HTTP)
Isto abrirá a porta 80 com o nome HTTP 80 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="HTTP 80" dir=in action=allow protocol=TCP localport=80 netsh advfirewall firewall add rule name="HTTP 80" dir=out action=allow protocol=TCP localport=80
Abrir porta 443 (HTTPS)
Isto abrirá a porta 443 com o nome HTTPS 443 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="HTTPS 443" dir=in action=allow protocol=TCP localport=443 netsh advfirewall firewall add rule name="HTTPS 443" dir=out action=allow protocol=TCP localport=443
Abrir porta 25 (SMTP)
Isto abrirá a porta 25 com o nome SMTP 25 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="SMTP 25" dir=in action=allow protocol=TCP localport=25 netsh advfirewall firewall add rule name="SMTP 25" dir=out action=allow protocol=TCP localport=25
Abrir porta 110 (POP3)
Isto abrirá a porta 110 com o nome POP3 110 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="POP3 110" dir=in action=allow protocol=TCP localport=110 netsh advfirewall firewall add rule name="POP3 110" dir=out action=allow protocol=TCP localport=110
Abrir porta 143 (POP3S)
Isto abrirá a porta 143 com o nome IMAP 143 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="IMAP 143" dir=in action=allow protocol=TCP localport=143 netsh advfirewall firewall add rule name="IMAP 143" dir=out action=allow protocol=TCP localport=143
Abrir porta 465 (SMTPS)
Isto abrirá a porta 465 com o nome SMTPS 465 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="SMTPS 465" dir=in action=allow protocol=TCP localport=465 netsh advfirewall firewall add rule name="SMTPS 465" dir=out action=allow protocol=TCP localport=465
Abrir porta 587 (SUBMISSION)
Isto abrirá a porta 587 com o nome SUB 587 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="SUB 587" dir=in action=allow protocol=TCP localport=587 netsh advfirewall firewall add rule name="SUB 587" dir=out action=allow protocol=TCP localport=587
Abrir porta 993 (IMAP 993)
Isto abrirá a porta 993 com o nome IMAP 993 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="IMAP 993" dir=in action=allow protocol=TCP localport=993 netsh advfirewall firewall add rule name="IMAP 993" dir=out action=allow protocol=TCP localport=993
Abrir porta 995 (POP3S)
Isto abrirá a porta 995 com o nome POP3S 995 (comunicação de entrada e saída)
netsh advfirewall firewall add rule name="POP3S 995" dir=in action=allow protocol=TCP localport=995 netsh advfirewall firewall add rule name="POP3S 995" dir=out action=allow protocol=TCP localport=995
Para um processo automático, basta criar um script com o código abaixo!
Abre um ficheiro de texto, copie e cole o código abaixo e guarda como (por exemplo) FIREWALL.bat
@echo off ::Autor: Vítor Fernandes ::Página web: https://duploclique.pt ::Data: 27-OUT-2020 title ABRE PORTAS SMTP, SMTPS, IMAP E POP3 ^| duploclique.pt mode 70,3 chcp 850 > nul color F > nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" if '%errorlevel%' NEQ '0' ( goto AbrirUAC ) else ( goto AbrirBatch ) :AbrirUAC echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /B :AbrirBatch if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%cd%" cd /d "%~dp0" set PATH=%~dp0;%PATH% echo A DEFINIR PORTA SMTP 25... timeout 1 /nobreak > nul netsh advfirewall firewall add rule name="SMTP" dir=in action=allow protocol=TCP localport=25 netsh advfirewall firewall add rule name="SMTP" dir=out action=allow protocol=TCP localport=25 cls echo A DEFINIR PORTA SMTP 25... OK^! timeout 2 /nobreak > nul cls echo A DEFINIR PORTA SMTP 587... timeout 1 /nobreak > nul netsh advfirewall firewall add rule name="Submission" dir=in action=allow protocol=TCP localport=587 netsh advfirewall firewall add rule name="Submission" dir=out action=allow protocol=TCP localport=587 cls echo A DEFINIR PORTA SMTP 587... OK^! timeout 1 /nobreak > nul cls echo A DEFINIR PORTA SMTPS 465... timeout 1 /nobreak > nul netsh advfirewall firewall add rule name="SMTPS" dir=in action=allow protocol=TCP localport=465 netsh advfirewall firewall add rule name="SMTPS" dir=out action=allow protocol=TCP localport=465 cls echo A DEFINIR PORTA SMTPS 465... OK^! timeout 1 /nobreak > nul cls echo A DEFINIR PORTA IMAP 993... timeout 1 /nobreak > nul netsh advfirewall firewall add rule name="IMAP" dir=in action=allow protocol=TCP localport=993 netsh advfirewall firewall add rule name="IMAP" dir=out action=allow protocol=TCP localport=993 cls echo A DEFINIR PORTA IMAP 993... OK^! timeout 1 /nobreak > nul cls echo A DEFINIR PORTA POP3S 995... timeout 1 /nobreak > nul netsh advfirewall firewall add rule name="POP3S" dir=in action=allow protocol=TCP localport=995 netsh advfirewall firewall add rule name="POP3S" dir=out action=allow protocol=TCP localport=995 cls echo A DEFINIR PORTA POP3S 995... OK^! timeout 1 /nobreak > nul cls echo PROCESSO FINALIZADO... A FECHAR JANELA^! timeout 1 /nobreak > nul & exit /b 0