Solved

getting warning when i try to send password to mail......!! can some one help me whith settings for sendmail?

Posted on 2006-11-01
10
248 Views
Last Modified: 2008-02-01
Warning: mail() [function.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:\Programfiler\xampp\htdocs\PhP1\PhP_Uke6\include\WikiHtml\SendPassword_mail.php on line 72
Kan ikke sende passord til mail add din.!

her is my php.ini

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "C:\Programfiler\xampp\sendmail\sendmail.exe -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

[SQL]
sql.safe_mode = Off

[ODBC]
;odbc.default_db    =  Not yet implemented
;odbc.default_user  =  Not yet implemented
;odbc.default_pw    =  Not yet implemented

; Allow or prevent persistent links.
odbc.allow_persistent = On

; Check that a connection is still valid before reuse.
odbc.check_persistent = On

; Maximum number of persistent links.  -1 means no limit.
odbc.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
odbc.max_links = -1

; Handling of LONG fields.  Returns number of bytes to variables.  0 means
; passthru.
odbc.defaultlrl = 4096


and
*******************************************************
; configuration for fake sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server

smtp_server=localhost


; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

;default_domain=local

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

;error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

;debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

;auth_username=
;auth_password=

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines

;pop3_server=
;pop3_username=
;pop3_password=

; to force the sender to always be the following email address, uncomment and
; populate with a valid email address.  this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content

;force_sender=me@localhost

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting.  you can manually set the ehlo/helo name if required

;hostname=localhost
*********************************************************
0
Comment
Question by:Adnan
  • 6
  • 4
10 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 17849742
What is your mail server's correct address?

-r-
0
 

Author Comment

by:Adnan
ID: 17849861
IP ADRESS to my mail server is 193.213.115.8 or shod i install Mail Access Monitor for SendMail 3.2 from download.com?
0
 

Author Comment

by:Adnan
ID: 17849898
roonan can u plz guide me thro this problem?
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 17849911
Hi,

Then you should just put the ip address or hostname in your php.ini:

[mail function]
; For Win32 only.
SMTP = 193.213.115.8
smtp_port = 25

Not forget to restart the server to make sure it re-reads the php.ini.

-r-
0
 

Author Comment

by:Adnan
ID: 17849948
hmmmm....Oki now i get this message

Warning: mail() [function.mail]: SMTP server response: 553 5.5.4 <your name <your email>>... Domain name required for sender address your.email in C:\Programfiler\xampp\htdocs\PhP1\PhP_Uke6\include\WikiHtml\SendPassword_mail.php on line 72
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 49

Expert Comment

by:Roonaan
ID: 17849980
Then you probably need to use:

mail('someone@somedomain.com', ...
rather than

mail('someone', ...

-r-
0
 

Author Comment

by:Adnan
ID: 17849988
i think maybe i get cloeaser know...i get error message from my cod ethat the email name i try to send password to does not exist in my db.......i am sending you my code so u can look at it

function Send_Password_mail(){
 $_mysqlHost["host"] = "localhost:25";
$_mysqlUsername["username"] = "gonadn";
$_mysqlPassword["password"] = "adn0420";
$_mysqlDatabase["database"] = "wiki";
      
 if ($_mysqlDatabase["database"]!= "wikiusers") {
                  $connection = mysql_connect('localhost','gonadn','adn0420')
                          or die (
            print mysql_error($connection));
               mysql_select_db ('wiki')
       
        or die (
           print mysql_error($connection));
                  
                  if (!$connection) {
                     print("<div class=\"error\">Kunne ikke koble til databaseserveren: " . mysql_error() . "</div>");
                  }
                  else {
                         if (!@mysql_select_db("wiki", $connection)) {
                               print("<div class=\"error\">Kunne ikke koble til databasen: " . mysql_error() . "</div>");
                         }
                         else {
                               //$confirm_code=md5(uniqid(rand()));
                               // value sent from form
                              $email=$_POST['email'];

                        // table name
                        $tbl_name=wikiusers;

                        // retrieve password from table where e-mail = $email_to(mark@phpeasystep.com)
                        $sql="SELECT password FROM $tbl_name WHERE email='$email'";
                        $result=mysql_query($sql);

                        // if found this e-mail address, row must be 1 row
                        // keep value in variable name "$count"
                        $count=mysql_num_rows($result);

                        // compare if $count =1 row
                        if($count==1){

                              $rows=mysql_fetch_array($result);

                              // keep password in $your_password
                              $your_password=$rows['password'];

                        // ---------------- SEND MAIL FORM ----------------

                        // send e-mail to ...
                        $to=$email;

                        // Your subject
                        $subject="Your password here";

                        // From
                        $header="from: your name <gonadn@nith.no>";

                        // Your message
                        $messages= "Your password for login to our website \r\n";
                        $messages.="Your password is $your_password \r\n";
                        $messages.="more message... \r\n";

                        // send email
                        $sentmail = mail($to,$subject,$messages,$header);

}

                  // else if $count not equal 1
                  else {
                        print "Mail adressen finnes ikke i databasen";
                  }

                  // if your email succesfully sent
                  if($sentmail){
                        print "Passordet har blitt sendt til mail addressen din.!";
                  }
                  else {
                        print "Kan ikke sende passord til mail add din.!";
                  }
}


                  }}}
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 17850020
What did you fill in for $_POST['email']; ?

-r-
0
 

Author Comment

by:Adnan
ID: 17850068
i fill in the mail adress i want to send password to......but now suddenly i tryied again and it worked.....the mail hvae ben sent to my gmail adress......;)
0
 

Author Comment

by:Adnan
ID: 17850274
thanks for helping roonaN
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now