FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mail system......an mysql....





salman_500
hey guyz,

i have this email verification in my user registration system... i wanted to know that why am i getting this lill thing when i test it on my computer....

this code is from the password recovery section..... but is pretty much the same as the original verification....


Quote:
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\Apache Group\Apache2\htdocs\Solo Themes\forgot.php on line 273
Your password has been sent! Please check your email!


this is the code for it...

Code:
if ($_POST['Recover']) {
    
   $email_address = $_POST['email_address'];
   
    if(!$email_address){
        echo "<b><font color=\"red\">You forgot to enter your Email address !
           </font><b><br><br>";
        include 'includes/lost_pw.htm';
         
    }
   else {
    // quick check to see if record exists     
    $sql_check = mysql_query("SELECT * FROM users WHERE email_address='$email_address'");
    $sql_check_num = $sql_check;
    if($sql_check_num == 0){
        echo "No records found matching your email address<br />";
        include 'includes/lost_pw.htm';
         
    }
   else {
    // Everything looks ok, generate password, update it and send it!
     
    function makeRandomPassword() {
          $salt = "abchefghjkmnpqrstuvwxyz0123456789";
          srand((double)microtime()*1000000); 
          $i = 0;
          while ($i <= 7) {
                $num = rand() % 33;
                $tmp = substr($salt, $num, 1);
                $pass = $pass . $tmp;
                $i++;
          }
          return $pass;
    }

    $random_password = makeRandomPassword();

    $db_password = $random_password;
     
    $sql = mysql_query("UPDATE users SET password='$db_password' 
                WHERE email_address='$email_address'");
     
    $subject = "Your Password at SoloThemes!";
    $message = "Hi, we have reset your password.
     
    New Password: $random_password
     
    http://www.Solothemes.com
     
    Thanks!
    The Webmaster
     
    This is an automated response, please do not reply!";
     
    mail($email_address, $subject, $message, "From: SoloThemes Webmaster<no-reply@solothmes.com>\n
        X-Mailer: PHP/" . phpversion());
    echo "Your password has been sent! Please check your email!<br /><br />";
   
}
}
}



plz tell me if there is any error.....or if i need to do somthin with the php-ini file........

or is it just that i cant test mail things on my computer....


also one more thing... why is is that when i delete records from phpmyadmin... the id of the rows does not reset... like i mean that e.g:

i have 2 rows with id's "1" and "2"...

when i delete row 2.... and add another row.... its id is 3 and not 2........ i use auto increment though...

thnx !
scotty
I think it means that you haven't sent up your computer to send mail through PHP. I haven't set this up myself but I expect you should be able to find some help by searching on Google for "setting up Apache/PHP to send email".

As for auto increment I get that too, I think that is the point of auto increment though. If you don't want that, as in you don't need to ID your records just turn it off and order them how you want. Then again I know next to nothing and this post probably didn't help you at all. Have a nice day Razz
salman_500
scotty wrote:
Then again I know next to nothing and this post probably didn't help you at all. Have a nice day Razz


Exactly !! Razz Wink Cool Smile jk Very Happy
hexkid
salman_500 wrote:
i have this email verification in my user registration system

Find the name of your ISP's SMTP server, than change php.ini
Code:

[mail function]
; For Win32 only.
SMTP = YOURISP's.SMTP.com
smtp_port = 25

; For Win32 only.
sendmail_from = YOURUSERNAME@YOURISP.com



salman_500 wrote:
why is is that when i delete records from phpmyadmin... the id of the rows does not reset...

That's the way it's supposed to work. If you need to reset the auto numbering of the primary key auto_increment column, do this (initialization, error checking, and cleanup not shown):
Code:
<?php
$sql = "select max(TABLEID) from DATATABLE";
$res = mysql_query($sql);
$last_id = mysql_result($res, 0);
$next_id = $last_id + 1;
$sql = "alter table DATATABLE auto_increment=$next_id";
mysql_query($sql);
?>
salman_500
hexkid wrote:
salman_500 wrote:
i have this email verification in my user registration system

Find the name of your ISP's SMTP server, than change php.ini
Code:

[mail function]
; For Win32 only.
SMTP = YOURISP's.SMTP.com
smtp_port = 25

; For Win32 only.
sendmail_from = YOURUSERNAME@YOURISP.com



????? Confused Shocked Confused Shocked Confused Shocked Confused Mad Embarassed

Blank !!!

please tell in english... Wink

its on my computer...localhost.... what is " ISP's SMTP server"........

please explain how i can do so.... thnx...
avk
Hey! salman_500

i think that the computer's localhost cannot send email.
u should put all your files and database on a php & mysql supporting server.

localhost has no right to send mail.

and ya what hexkid wrote was in english.
hexkid
salman_500 wrote:
please tell in english...


See the Microsoft page for setting up Outlook Express. Look at point 6. there; the "Outgoing mail (SMTP) server" is what you need to put in php.ini.
salman_500
hexkid wrote:
salman_500 wrote:
please tell in english...


See the Microsoft page for setting up Outlook Express. Look at point 6. there; the "Outgoing mail (SMTP) server" is what you need to put in php.ini.


i really dont use outlook express and am totally clueless on what to do.... cant you just pleaze tell me what to add and where???

thnx !
hexkid
salman_500 wrote:
cant you just pleaze tell me what to add and where???

I already did!

Code:
[mail function]
; For Win32 only.
SMTP = YOUR_ISP'S_SMTP_SERVER
smtp_port = 25

; For Win32 only.
sendmail_from = YOURUSERNAME@YOURISP.COM


But I don't know what is your ISP'S SMTP server is. You are the one who knows that. My ISP is NetCabo and on a FAQ page somewhere they say
Quote:
Qual o endereço dos servidores de correio da Netcabo?


pop.netcabo.pt (Servidor de correio a receber)

smtpa.netcabo.pt (Servidor de correio a enviar)

which can be translated as

What are the addresses of NetCabo mail servers?
pop.netcabo.pt (incoming mail server (POP3))
smtpa.netcabo.pt (outgoing mail server (SMTP)).


So, if I were to update my php.ini to use my ISP's SMTP, it would become
Code:
[mail function]
; For Win32 only.
SMTP = smtpa.netcabo.pt
smtp_port = 25

; For Win32 only.
sendmail_from = MYACCOUNTNAME@netcabo.pt
salman_500
does it matter...or is it different if your on dial-up??? coz i am ........ Embarassed
hexkid
salman_500 wrote:
does it matter...or is it different if your on dial-up???

It is the same thing. You need to specify an SMTP server and an account for that server in the proper php.ini lines.

Some ISPs do not provide an SMTP server. If that is the case for you, you might want to search the net for a free mail server which provides an SMTP server (no Hotmail (*1), no Yahoo (*2), no Gmail(*3)) and use that instead.

(*1) as far as I know Hotmail does not provide SMTP server at all
(*2) I think Yahoo provides one for paying accounts
(*3) Gmail's SMTP server requires authentication and is not suitable for PHP
salman_500
hey...

i think i can work withou settin up that ini file...correct me if im rong but when i send the mail i get this error..

Quote:
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\Apache Group\Apache2\htdocs\Solo Themes\forgot.php on line 272


the highlited part says that it is not set-up....

so can you look at this line 272 273 of my code... and tell me if there is somthing rong with it...

Code:
    mail($email_address, $subject, $message, "From: SoloThemes Webmaster<no-reply@solothmes.com>\n
        X-Mailer: PHP/" . phpversion());


thnx !
hexkid
Try this
Code:
    mail($email_address, $subject, $message, "From: \"SoloThemes Webmaster\" <no-reply@solothmes.com>\r\nX-Mailer: PHP/" . phpversion());


I changed SoloThemes Webmaster<noreply@solothmes.com> to "SoloThemes Webmaster" <noreply@solothemes.com>;
I also changed "\n" to "\r\n". That's the specification for mail but many servers don't care about it; anyway it doesn't hurt to follow specifications;
and finally I removed blanks before X-Mailer and the two lines are 1 single line now.
salman_500
hexkid wrote:
Try this
Code:
    mail($email_address, $subject, $message, "From: \"SoloThemes Webmaster\" <no-reply@solothmes.com>\r\nX-Mailer: PHP/" . phpversion());


I changed SoloThemes Webmaster<noreply@solothmes.com> to "SoloThemes Webmaster" <noreply@solothemes.com>;
I also changed "\n" to "\r\n". That's the specification for mail but many servers don't care about it; anyway it doesn't hurt to follow specifications;
and finally I removed blanks before X-Mailer and the two lines are 1 single line now.



no...... Crying or Very sad

i still get this....

Quote:
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\Apache Group\Apache2\htdocs\Solo Themes\forgot.php on line 272


Sad
hexkid
salman_500 wrote:
no......


What about this?
Code:
    ini_set('sendmail_from', 'From: "SoloThemes Webmaster" <no-reply@solothmes.com>');
    mail($email_address, $subject, $message, "X-Mailer: PHP/" . phpversion());
salman_500
hexkid wrote:
salman_500 wrote:
no......


What about this?
Code:
    ini_set('sendmail_from', 'From: "SoloThemes Webmaster" <no-reply@solothmes.com>');
    mail($email_address, $subject, $message, "X-Mailer: PHP/" . phpversion());


hey...this part seems to work..... but now i get this...

Quote:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\Solo Themes\forgot.php on line 273


one question though... when i upload the site to a aserver...will i still face errors in mailing from a website or everything will be pre-set???

thnx !
hexkid
salman_500 wrote:
now i get this...

Quote:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\Solo Themes\forgot.php on line 273

This means your localhost does not have a mailserver installed. You'd be better off finding a suitable mailserver on the internet and changing your php.ini settings to use it (see posts above this one).

salman_500 wrote:
one question though... when i upload the site to a aserver...will i still face errors in mailing from a website or everything will be pre-set???

Depends on the hosting company. On frihost there is a properly configured mailserver installed you can use; ask for details on Web Hosting Support forum.
Related topics
Mail system
Fedora Core 5 Test 1 Review
Where did these new mail tools come from on DA?
how to set frih mail to request read-receipt?
DirectAdmin Ticket System
E-mail problem
Trouble sending e-mail to hotmail
Setting up POP email to work with our subdomains
[man]Servidor Web Personal (Tutorial)
*OFFICIAL* Which Browser do you use?
AOL not accepting emails
Gmail to your domain.
Email - which do you think is most secure?
WoW vs Knight Online
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.