www.webdeveloper.com
Results 1 to 11 of 11

Thread: Php Mail() problem

  1. #1
    Join Date
    Aug 2009
    Posts
    6

    Arrow Php Mail() problem

    Hi everyone !
    I have this problem that cant be solved, 3 days "googling" around for no hope.

    Here is my PHP code

    <?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $feedback = $_POST['feedback'];

    $toaddress = "Something@yahoo.com";
    $subject = "FeedBack from website";

    $mailcontent = "Customer name:".$name."\n";
    "Customer E-mail:".$email."\n";
    "Customer Comments:".$feedback."\n";

    $fromaddress = "From : Something@yahoo.com";

    mail($toaddress, $subject, $mailcontent, $fromaddress);
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Bob's Auto Part - Feedback Submitted</title>
    </head>
    <body>
    <h1>Feedback Submitted</h1>
    <p>Your feedback has been sent.</p>
    </body>
    </html>

    I've set my smtp in php.ini and port...But i think its a Username and Password issue coz i'm trying to connect to Yahoo.

    How to add a code there, i'm newbie

  2. #2
    Join Date
    May 2003
    Posts
    599
    Give some details on your mail setup. What kind of web server are you using? and is smtp set up on that server, or are you trying to relay through another smtp server?

    Also make sure all your mail content is in the same variable.
    PHP Code:
    $mailcontent "Customer name:".$name."\n";
    $mailcontent .= "Customer E-mail:".$email."\n";
    $mailcontent .= "Customer Comments:".$feedback."\n"
    In your From, remove the space before the colon:
    PHP Code:
    $fromaddress "From: Something@yahoo.com"
    And you might first attempt the mail function without the 4th arguement, that will send the message using the web servers defaults and will be easier to troubleshoot the servers mail config...if your message is successful, then you can mess with the headers.
    PHP Code:
    mail($toaddress$subject$mailcontent); 
    Last edited by hastx; 08-23-2009 at 07:16 AM.
    We do precision guesswork

  3. #3
    Join Date
    Aug 2009
    Posts
    6
    Quote Originally Posted by hastx View Post
    Give some details on your mail setup. What kind of web server are you using? and is smtp set up on that server, or are you trying to relay through another smtp server?

    Also make sure all your mail content is in the same variable.
    PHP Code:
    $mailcontent "Customer name:".$name."\n";
    $mailcontent .= "Customer E-mail:".$email."\n";
    $mailcontent .= "Customer Comments:".$feedback."\n"
    Thanks for replying.
    Okay Umm, Running Apache server 2.2.9(WIN32) / PHP5.2.6.

    Now according to smtp in php.ini----
    [mail function]
    ; For Win32 only.
    SMTP = smtp.bizmail.yahoo.com
    smtp_port = 465

    ; For Win32 only.
    sendmail_from = something@yahoo.com
    ----

    HTML form design:

    <body>
    <form action="viewfeedback.php" method="post">
    <table border="0">
    <tr><td><b>Customer Feedback</b></td></tr>
    <tr><td>Please Tell us what you think</td></tr>
    <tr><td>Your Name</td></tr>
    <tr><td><input type="text" size="20" name="name" /></td></tr>
    <tr><td>Your E-mail Address:</td></tr>
    <tr><td><input type="text" size="20" name="email" /></td></tr>
    <tr><td>Your Feedback</td></tr>
    <tr><td><input type="text" size="40" style="height:50px" name="feedback" /></td></tr>
    <tr><td><input type="submit" value="Send Feedback" /></td></tr>
    </table>
    </form>
    </body>

    That's all i know.

  4. #4
    Join Date
    May 2003
    Posts
    599
    Quote Originally Posted by scaryhunter View Post

    Now according to smtp in php.ini----
    [mail function]
    ; For Win32 only.
    SMTP = smtp.bizmail.yahoo.com
    smtp_port = 465

    ; For Win32 only.
    sendmail_from = something@yahoo.com
    ----
    Assuming the changes had no effect on the results, two questions need to be answered:
    • does smtp.bizmail.yahoo.com allow unauthenticated relaying?
    • Is port 465 open, or is it fire-walled somewhere?


    if both are not true, you wont be able to get your mail out with that config
    Last edited by hastx; 08-23-2009 at 08:22 AM.
    We do precision guesswork

  5. #5
    Join Date
    Nov 2008
    Posts
    2,477
    What OS is your server running?

  6. #6
    Join Date
    Aug 2009
    Posts
    6
    Quote Originally Posted by Mindzai View Post
    What OS is your server running?
    Windows XP.

  7. #7
    Join Date
    Aug 2009
    Posts
    6
    Still not working.
    Okay i realized that port 465 was not open, i did port forwarding my Netgear router...But still failed to send any e-mail.
    I think it might be about SSL?..How do i implement ssl in smtp.php
    Here is Smtp.php code :

    ----
    class Mail_smtp extends Mail {


    var $_smtp = null;

    var $host = 'smtp.bizmail.yahoo.com';

    var $port = 465;

    var $auth = true;

    var $username = 'something@yahoo.com';

    var $password = 'Mypassword';

    var $localhost = 'something@yahoo.com';

    var $timeout = null;

    var $verp = false;

    var $debug = false;

    -----
    Or maybe ISP could be blocking that?...I'm really lost

    Thanks for help guys.

  8. #8
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    Don't understand why you need to set up all those variables when your using a basic php mail() function. If you were using the set of imap mail functions then I could understand why but your not.

    You also need to add some header information, the mail() function takes 4 parameters and you only have three.

    If you search this site, you will find examples of how to make up an email header.

  9. #9
    Join Date
    Aug 2009
    Posts
    6
    Quote Originally Posted by JunkMale View Post
    Don't understand why you need to set up all those variables when your using a basic php mail() function. If you were using the set of imap mail functions then I could understand why but your not.

    You also need to add some header information, the mail() function takes 4 parameters and you only have three.

    If you search this site, you will find examples of how to make up an email header.
    Okay now another problem showed up !

    Warning: mail() [function.mail]: SMTP server response: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\viewfeedback.php on line 16

    I went to yahoo help website, and everything seems to be true...

  10. #10
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    Can you please explain what it is your trying to do? Are you wanting to send email from your web space or are you trying to write an email client that collects mail?

    As for the yahoo site, it is explaining what you need to do to collect emails in a client like thunderbird, outlook or one of the many other email clients that are available.

    If your collecting emails, I see no need for your use of mail() function. so can you please clarify and post the actual code your using and please rememebr the forum tags for it, makes it easier for people to see your code.

  11. #11
    Join Date
    Aug 2009
    Posts
    6

    Unhappy

    Quote Originally Posted by JunkMale View Post
    Can you please explain what it is your trying to do? Are you wanting to send email from your web space or are you trying to write an email client that collects mail?

    As for the yahoo site, it is explaining what you need to do to collect emails in a client like thunderbird, outlook or one of the many other email clients that are available.

    If your collecting emails, I see no need for your use of mail() function. so can you please clarify and post the actual code your using and please rememebr the forum tags for it, makes it easier for people to see your code.
    Thanks for reply!
    Well as i mentioned before i'm a newbie :P, anyways Yes i'm willing to send e-mail from my Yahoo mail to another address.
    I know how to do it in outlook , but i meant by using the code i wrote earlier.
    After googling around i found this Exact problem that showed to me ( But couldnt find an answer :

    Warning: mail(): SMTP server response: 530 authentication required - for
    help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html in c:\program
    files\apache group\apache\htdocs\viewfeedback.php on line 15

    I receive the error above when I attempt to send mail via a PHP script.

    How can i solve this situation?
    --
    Thats what i always Get, do i have to install Auth pear?...How do i need to enable SSL?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles