PHP email signup system Localhost

Hi,

I am creating a project and I am looking to create a php email signup system whereby when a user signs up they are sent an email with a confirmation code on it which they then click and a registered as a fully fledged member.

The tutorial I am using is the following:
www.phpeasystep.com/phptu/24.html

Its a very good tutorial and does explain a a great deal. But the problem is I wish to have this working over localhost for testing purposes.

Instead of using an installed mail server over the network I would like to use the gmail SMTP mail server if I can?? which potentially uses elements from this tutorial:
www.asif18.com/7/php/send-mails-using-smtp-in-php-by-gmail-server-or-own-domain-server/

Is this possible or am i barking up the wrong tree??

Thanks

Using the second tutorial will steer you in the right direction, for using PHPMailer will get you where you want to go. The first tutorial while probably good is getting a little outdated; however, that is not to say you can’t use it as reference. Look at PHPMailer’s documentation it will guide you on how to send email using a local server, it’s actually pretty easy in my opinion.

Hi,

Thanks for the response.

The system is a school project which basically specifies that the user on signup is created a a temporary user until they click on the confirmation link in the email. The first tutorial will meet the need of what is specified but it just will not send an email as we are operating over a school network.

I just thought that adding something such as a mailer.php file which has the following code:
[php]<?php

$smtp = array(
‘transport’ => ‘Smtp’,
‘from’ => ‘[email protected]’,
‘host’ => ‘ssl://smtp.gmail.com’,
‘port’ => 465,
‘timeout’ => 30,
‘username’ => ‘[email protected]’,
‘password’ => ‘***********’
)

?>[/php]

and then including this code into my php processing code would be the way foward eg:
[php]<?php

include(‘config.php’);
include(‘mailer.php’);

// table name
$tbl_name=temp_members_db;[/php]

bumping this. Does anyone have a possible solution for us to use please?

I’m leaving for many hours so I can not respond again for awhile.
But, PHP has a mail function built into it. I assume that is why you set up the array for all of the
SMTP info. PHP’s mail function does not need SMTP to be used, but, SMTP is a bit more secured.

Anyway, you showed us how you set up SMTP, but, you did not show us how you are using it
or how you are calling the mail functions. Also, you did not mention what errors you were getting
when trying to mail out.

So, here is a sample that I found that shows sending mail with SMTP. I would just use the built in
PHP mail function as it works everywhere I have tested it. Using SMTP sometimes can be a problem
since some server’s consider this “email redirection” and may not let it go thru. Gmail seems to let
them be sent out. Anyways, hope this helps:
[php]

<?php require_once "Mail.php"; $from = "Sandra Sender "; $to = "Ramona Recipient "; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "mail.example.com"; $username = "smtp_username"; $password = "smtp_password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("

" . $mail->getMessage() . "

"); } else { echo("

Message successfully sent!

"); } ?>

[/php]
You would have to change all the fields to fit your usage. Hope that helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service