Access localhost [closed]

closed . This question needs details or to be clearer and is not currently accepting answers.

want to improve this question? Add details and make it clearer what problem is being solved by editing this post .

Closed 3 years ago .

improve this question

I recently changed my apache port by xampp to Port 465, but how do I access my localhost on the net now? I put localhost:465/mail/ and it does not load.

Author: Maria, 2017-11-30

2 answers

  • Apache is a service that uses the HTTP protocol (which is based on TCP)
  • SMTP is a separate service and protocol, which has nothing to do with HTTP and websites
  • IMAP and POP3 are other services and protocols also different

Each of these has no relation to the other, and SMTP, IMAP and POP3 have no connection at all with web page development.

It makes no sense to set the Apache port to be that of SMTP, it's the same as waiting for a taxi to take you until Hawaii , they are services for different things.

Apache is to serve web pages, SMTP has to have its own program smtp server, usually contracted hosting already serve this, if you want to use your own domain.

Now if you are thinking of using a hosting that already has SMTP service or are thinking of using Gmail or Outlook.com you should configure the port directly in PHPMailer, in short, the path is this:

  • Teu script goes inside the www or public_html folder that belongs to Apache
  • your script communicates via TCP with SMTP using PHPMailer, i.e. it has nothing to do with Apache
  • phpmailer sends the commands for this communication and waits for the response
  • the phpmailer response that came via TCP is saved in a variable
  • you display this variable via PHP if you want

In short Apache has nothing to do with SMTP.


As resolve

  • Apache server (program) uses port 80 or 8080 (or any other non-conflicting)
  • smtp server (program) uses Port 465 (if you have any smtp server program on your machine)

If SMTP is from an existing server or service, if your email account is on locaweb

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'email-ssl.com.br';
$mail->Port = 465;  
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->IsHTML(true);
$mail->Username = '[email protected]';
$mail->Password = 'senhadoemail';

If your email is in Gmail:

Gmail needs to free access, see the step by step: https://pt.stackoverflow.com/a/41458/3635

$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls'; //Gmail usa TLS
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "sua senha";

If your email is in live:

$mail->Host = 'smtp.live.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tsl'; //Live usa TLS
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "sua senha";

If the email does not use SSL / TLS then you should remove the line $Mailer->SMTPSecure (or set to false) and add the following line:

$mail->SMTPAutoTLS = false;

Getting something like:

$mail->SMTPSecure = false;
$mail->SMTPAutoTLS = false;
$mail->SMTPAuth = true; //Define para autenticar
$mail->Host = '<seu host para SMTP>';
$mail->Port = <SUA PORTA, geralmente 587>;
$mail->Username = '<Seu usuário de e-mail, geralmente o e-mail completo>';
$mail->Password = "sua senha";
 3
Author: Guilherme Nascimento, 2017-12-01 15:01:51

Restore your locahost, you probably read wrong about the SMTP port, it is configured inside PHP and not in localhost.

An example line for configuring SMTP in php:

$mail->Port = 465;

If you have more doubts follow these tutorials:

Simple Email: https://www.devmedia.com.br/enviando-email-com-php/37216

Email with SMTP: https://www.gn10.com.br/blog/dicas/envie-emails-php-smtp-gmail-google-apps /

Important :

Some email providers such as gmail, by default block connections from less secure applications and in order for the recipient to receive the email you have to allow the connection in the sender gmail, in case of gmail follow this tutorial: https://support.google.com/accounts/answer/6010255?hl=pt-BR

 1
Author: Brewerton Santos, 2017-11-30 15:23:47