Access localhost

Asked

Viewed 2,068 times

0

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 does not carry.

  • What’s the reason for the change? It’s just back to normal

  • I need to email via SMTP by phpmailer, it says that the smtp port to send the email is this

  • SMTP has nothing to do with HTTP. That is, SMTP does not open via browser, which is exactly what you want to do?

  • I need to email via SMTP by phpmailer, then it says that the smtp port to send the email is this. So I changed the apache ports to 465, and now my localhost is no longer working, no longer opens the page

  • 1

    But that makes no sense, 465 is to use in SMTP which is a protocol, if you set in Apache, which is HTTP you will mix two things that nothing has to be.

  • So in the case here: /Server name $Mailer->Host = 'localhost:8080'; Ta right?

  • So how would I put the host? I need to send emails by phpmailer which is by SMTP

  • 2

    SMTP is a service, if you have an SMTP service installed on your machine will work, otherwise it will not, if you are using an external SMTP service such as gmail, Hotmail (outlook) or yahoo, you have to configure phpmailer as if you were setting up your email client, for example Thunderbird or Outlook, the answer I tried to explain the best that gave https://answall.com/a/259422/3635, read it calmly, because it is clear that you still do not understand the basics of what is SMTP and TCP.

Show 3 more comments

2 answers

3


  • 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 link with web page development.

It makes no sense to define the Apache port as the SMTP, it’s the same as waiting for a taxi to take you to the Hawaii, are services for different things.

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

Now if you’re thinking of using a hosting that already has SMTP service or you’re thinking of using Gmail or Outlook.com you should set up the port directly in Phpmailer, in short, the way is this:

  • Your script goes inside the www or public_html folder that belongs to Apache
  • Your script communicates via TCP with SMTP using Phpmailer, which means it has nothing to do with Apache
  • phpmailer sends commands for that communication and waits for the answer
  • The phpmailer response that came via TCP is saved in a variable
  • You display this variable via PHP if you want

Summarizing Apache has nothing to do with SMTP.


How to solve

  • Apache server (program) uses port 80 or 8080 (or any other that does not conflict)
  • SMTP server (program) uses port 465 (if you have any server program for SMTP on your machine)

If the SMTP is from an existing server or service, if your account for email in the

$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 up access, see step by step: /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 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 define how 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";

1

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

an example line to configure SMTP in php:

$mail->Port = 465;

If you have more questions follow these tutorials:

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

Email Com 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 less secure application connections and for the recipient to receive the email you have to allow the connection to the gmail sender, in case gmail follow this tutorial: https://support.google.com/accounts/answer/6010255?hl=pt-BR

  • So in case I don’t need to touch the door of my apache there in the xampp? Can I leave being 8080?

  • no, this is unnecessary, you only edit the apache port in case it conflicts with any other app that uses the same port, as for example skype.

  • I get it. I did what you said, but the page just keeps loading and then it turns all white (when I send the email), and there is no email in my gmail. And I tried to do one with the example of github, but it says that the SMTP connection failed

  • remembering that the email sender of gmail (which will send the email) need to allow, configure gmail to allow unknown connections, google itself has this turorial.

  • Yes, I’ve done it and it’s still the same

Browser other questions tagged

You are not signed in. Login or sign up in order to post.