SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 06:36PM

Hi,

I'm trying to set up a SMTP, so users can register their e-mail address and password and be send to me via e-mail or insert an new record for them to the user login page. As i have looked at previous posts and i couldn't figure out how i could get it working.

As i have checked with gmail as they allow you to use SMTP, although i getting a TLS response.....
The issue that responds back to me from the browser is listed below:

-----------------------------------------------------------------------------------------------

Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first b30sm7800130ika.11 in C:\wamp\www\users\Website_3\public_html\mail.php on line 27

-----------------------------------------------------------------------------------------------

Please anyone can help me would be very grateful, as i need this working asap.

Thanks alot people.

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 06:39PM

why smtp?

cant you use php to record them in a database, or use a form to email them to you?
i can help with code for these...

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 07:07PM

Ok,

how would i approach to do this.

Thanks.

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 07:17PM

well if u wanna email it just make up a form


<form name="input" action="mailto:you@yourdomain.com'"
method="post">

Username:
<input type="text" name="user">
Password:
<input type="password" name="password">


<input type="submit" value="Submit">
</form>


this will work but its not always reliable
so i would go to [www.response-o-matic.com]
create an account, then wil give u code for ur form and then u just place it on ur site..
the form posts to them.. .then they email it to u- much more reliable

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 07:36PM

Hi,

How about recording it to the mysql database, that would be the most efficient way of approaching this issue? And sending out a confirmation e-mail to the user for becoming a registered user?

How would i approach this steps.

Thanks.

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 07:49PM

this would be on your page with the form
------------------------------------------------------------------------------------
<form action="processform.php" METHOD="POST" enctype="multipart/form-data" >

<input name="username" type="text" size="20"/>
<input name="password" type="password" size="10"/>

<INPUT class="button" name="submit" TYPE="submit" value="Submit">
<INPUT class="boldit" name="reset" TYPE="reset" value="Reset">
----------------------------------------------------------------------------

then you need a php file that will receive this and store it into the database
---------------------------------------------------------------------------------
<?php
{
$dbhost = 'localhost';
$dbuser = 'YOURUSERNAME';
mysql_connect($dbhost,$dbuser);
$dbname = 'YOURDATABASENAME';
@mysql_select_db($dbname) or die( "Unable to select database"winking smiley;

$username=$_POST['username'];
$password=$_POST['password'];


$query = "INSERT INTO YOURTABLENAME VALUES ('','$username','$password'')";
mysql_query($query);
mysql_close() ;
}
?>


u need to fill in your mysql username which should be 'root'

u need to fill in your database name

and also the tablename where the info is stored.- the table should have three colmns- id,username,password

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 07:58PM

Ok,

I know how to do all that including the error checking etc..... but i dont know how i could send a verification message to the user saying that they are registered or click on an e-mail that is e-mailed to them for activating their account.

Thanks alot.

Options: ReplyQuote
Re: SMTP - Help
Posted by: yfastud (Moderator)
Date: January 08, 2008 07:59PM

Instead using God Admin "root", you should create new db account for mail users only. Check Setup DB on my websites

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 08:07PM

im just showing the steps of setting it up- you should have a user and password to log into mysql


the only way to send a verifcation email is to use javascript to process the form twice

div style="visibility:hidden">
<iframe name="ifr1" width="20" height="20"></iframe>
<iframe name="ifr2" width="20" height="20"></iframe>
</div>

<script type="text/javascript">
function submitTwice(f){
f.action = 'processform.php';
f.target='ifr1';
f.submit();
f.action = 'mailto:your@email.com';
f.target='ifr2';
f.submit();
}
</script>


<form method="post">
<input name="username" type="text" size="20"/>
<input name="password" type="password" size="10"/>

<input name="email" type="hidden" value="Thanks for regerising on our site. Your logon details have been stored"/>

<input type="button" value="Send" onclick="submitTwice(this.form)">
</form>




this is kinda rough but its the quickest way to do it



Edited 1 time(s). Last edit at 01/08/2008 08:08PM by stevenmartin99.

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 08:09PM

oh no,

No i not allowed to use javascript. Its for my project. Please using php there must be another solution

Thanks

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 08:20PM

there isnt a way to post a form twice with out it..

but after u sumbit the details to ur php process form file u could use php to send the email
i presume there username will be there email? else u will have to collect it in the form also

<?php
$username==$email;
$subject = "subject text!";

$body = "main message";

if (mail($email, $subject, $body)) {
echo("<p> added to database</p>"winking smiley;
} else {
echo("<p>failed...</p>"winking smiley;
}
?>




if you want to send a verification email that they have to click

send them a link in the body to a page that asks them to sign in... if they sign in on this page then a value in the database should be made to change from unconfirmed to confirmed if u understand?

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 08:33PM

Hi,

So to send a mail i will have to use SMTP again?

i dont quite understand how i will make the changes to the database if they login to their account, this presumely wouldn't be quite secure as they could login in without reading their e-mail and it would still make the changes to the database?

Thanks

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 08:40PM

no no no you send them a link that is relevant to there details only
if they dont input there email and password it wont work
they will have to read email to get the link,,,


yes u will need to use phps email sending,,,

I Cant see another way arounf this if u cant use javascript.

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 08:43PM

Hi,

So the way you said would definitely work, and it will send an email out to them without me doing anything else?

Will i have to configure wamp to make this work?

Thanks

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 08:46PM

yes it will send the email, maybe u should forget the verifying bit,,,,,,its complicated if u dunno wat ur doing.

u need to generate a link that will pull up a verification page that will test there detials and check the database,,,

lot of trouble for just a project

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 08:47PM

as i just ran the script and i get the SMTP error...


Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first d25sm56233nfh.33 in C:\wamp\www\users\Website_1\Registration Form ----- public_html\process.php on line 31

Registration failed...

Options: ReplyQuote
Re: SMTP - Help
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: January 08, 2008 08:55PM

where are u hosting the site from? is it up on the net? or just on ur computer? is ur server set to access outside? ur isp could be even blocking this....

use someone elses smtp setings like a gmail account.

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 09:00PM

Hi,

I'm doing it from my wampserver, as i have set it to "smtp.gmail.com" in the php.ini file for SMTP. And it still doesn't work. I'm trying to use my gmail account to do this.

Thanks.

Options: ReplyQuote
Re: SMTP - Help
Posted by: ta5na (---.bb.sky.com)
Date: January 08, 2008 09:55PM

Hi,

I would be very appreciated if you could help me get this working, using SMTP. As i need this to work.

Thanks alot.

Options: ReplyQuote


Sorry, only registered users may post in this forum.