Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello i am new to this forum, with reference to Mr. Larry's book " PHP 6 AND MYSQL FOR DYNAMIC WEBSITES VISUAL QUICKPRO GUIDE" low price edition. Please, i have been trying to login a user for the  pass two days but i am not getting it right because i can't access the login page without activating the account which is done by clicking the the link in the email. So the problem is i don't receive the email after configuring the sendmail.ini and the php.in for the email, therefore i am stuck and i can't proceed. i even downloaded thunderbird for sending and receiving the emails and also configured the mercury  and added new users through on the control panel admin->configuration->manage users->Add...

I even tried creating the simple login page that will not require the user to activate his account through the link using the example in chapter 11. But still couldn't get it right.

Please i will really like to have help from this forum,

Thank you.

Edited by Jai
To tag main page of concern

Share this post


Link to post
Share on other sites

It will be my pleasure Mr. Larry, since i have tried various ways to no avail did i succeed.

Share this post


Link to post
Share on other sites

Please could anyone help me get this problem resolved,  Not being able to send mail using Xampp after i had followed the various instructions and also done some searches that does instructs same thing about php.ini and sendmail.ini file

Share this post


Link to post
Share on other sites

Ok, the following is how I send emails from PHP. Uses PHPMailer. In XAMPP you need to tell it where your normal email connection is.

$host = substr($_SERVER['HTTP_HOST'], 0, 5);
if (in_array($host, array('127.0', '192.1', 'local'))) 
	{
   	 	$local = TRUE;
		// echo "Local is true, HOST is $host";
	}
else 
	{
    	$local = FALSE;
		// echo "Local is false, HOST is $host";
	}

if ($local)
	{	// tests for using XAMPP locally
		ini_set('sendmail_from', 'your email address');		// needed for Win 10 localhost (Development)
		ini_set('SMTP', 'your email service SMTP server');			// needed for Win 10 localhost (Developmemt)
	}

require './includes/PHPMailer/PHPMailerAutoload.php';	// available as a free download
$mail = new PHPMailer(true);
$mail->setFrom(EMAIL, 'Whoever');
$mail->addAddress(EMAIL, 'Whoeverr');
if ($local)
	$mail->Subject  = 'The email subject';
else
	$mail->Subject  = 'The email subject';
$mail->Body     = 'The email body';
$mail->addAttachment($report_file);	// optional
if(!$mail->send()) 
	{
		echo '<p>Message was not sent.</p>';
		echo '<p>Mailer error: ' . $mail->ErrorInfo . '</p>';
	} 

The EMAIL constant has the email address that I want to show the email was sent from/to - in this case the receiver and the sender are the same email address - just change them to whatever you want to use.

Hope it helps.

P.S., assumes that you are logged in to your email service.

PPSS, I use PHPMailer as it lets you attach a file to an email if you want/need to.

Edited by Necuima
Added clarification
  • Like 1

Share this post


Link to post
Share on other sites

During the installation of the composer, there is an option that state "use a proxy server to connect to the internet". Could this please have something to do with sending the mail to ? 

As for now i am doing without it.

Share this post


Link to post
Share on other sites

I do not use a proxy server.

And my statement that you need to be logged in to your email service may be a bit mis-leading.  You need to be logged in to the Internet with your service provider.

Share this post


Link to post
Share on other sites

Ok,

Please after creating the phpmailer file as describe above, where do I include the file? is it possible for me to include this in the php script which i have created to send the mail, the user who wants to login?

Share this post


Link to post
Share on other sites

Hi Necuima! i have been able to do the installation of phpmailer and put my credentials successfully, but when i run the script on my browser, i have this resulting

Quote

2020-04-04 09:48:32 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP w16sm7501538pfj.79 - gsmtp
2020-04-04 09:48:32 CLIENT -> SERVER: EHLO localhost
2020-04-04 09:48:32 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2409:4072:79b:7a7f:646b:d8cb:d29f:2195]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2020-04-04 09:48:32 CLIENT -> SERVER: STARTTLS
2020-04-04 09:48:33 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2020-04-04 09:48:41 CLIENT -> SERVER: EHLO localhost
2020-04-04 09:48:42 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2409:4072:79b:7a7f:646b:d8cb:d29f:2195]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2020-04-04 09:48:42 CLIENT -> SERVER: AUTH LOGIN
2020-04-04 09:48:42 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2020-04-04 09:48:42 CLIENT -> SERVER: [credentials hidden]
2020-04-04 09:48:42 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2020-04-04 09:48:42 CLIENT -> SERVER: [credentials hidden]
2020-04-04 09:48:43 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials w16sm7501538pfj.79 - gsmtp
2020-04-04 09:48:43 SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials w16sm7501538pfj.79 - gsmtp
SMTP Error: Could not authenticate.
2020-04-04 09:48:43 CLIENT -> SERVER: QUIT
2020-04-04 09:48:43 SERVER -> CLIENT: 221 2.0.0 closing connection w16sm7501538pfj.79 - gsmtp
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.

Please could you explain what it really means because i turned of the 'less secure app' in my google account but i still couldn't receive any message.

Thanks

Jai.

Share this post


Link to post
Share on other sites

Hi,  I am sorry but I don't think that I can help you with this but I did notice "Username and Password not accepted" - did you check out the link at the end of that message?

I use my Internet login details with my service provider and have never had a problem.  These details may or may not be the same as your email address.

Hope it helps.

Share this post


Link to post
Share on other sites

Hi Necuima,  thank you

i did check the link and it redirects to a page that suggest i should turn off "less secure apps" in my google account which i did quite well but still turns out i am not able to send mail.

Thank you, 

Jai.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...