SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mail() problem on windows server

    Please can anybody help me out, I have this problem with mail() function on a windows server, and I am not used to it at all. Don't know how to fix it.

    please help. the code lines are shown below:
    PHP Code:
    function emailSignUp($email$mailing){
        
     
    $dat=date("Y-m-d");
     
    $email[]=$dat;
     
    //echo $email[1];
     
    add_value($email$mailing);
     
    $message='<p>You visited http://www.agagu2007.com. The official campaign site for Agagu 2007 on '.$email[2].'</p>
               <p>On your vist you signed-up for our emails with this email address: '
    .$email[1].'</p>
               <p>This message is to acknowledge your interest and voluntary subscription to our mailing list</p>
               <p>Please feel free to visit the website from time to time and view the changes taking place</p>
               <p>If you have any contribution, suggestion, or comment, please send a mail to contact@agagu2007.com or fill the applicable form on the site.</p>
               <p>If you want to report any abuse, mailto abuse@agagu2007.com</p>
               <p>If you require help or assistance on how to use the site; mailto help@agagu2007.com</p>
               <p>Once again thanks for your sincere interest. The SUN will continue to shine!</p>
               <p>Thanks!<br />Campaign Team</p>'
    ;

    //Initialize email variables
        
    $from="admin@agagu2007.com\n";
        
    $to$email[1];
        
    $body$message;
        
    $subject="News Subscription";
        if(@
    mail($to,$subject,$body,"From: $from")){
            echo 
    "Thanks, a message was sent to your inbox";
        }else{
            echo
    "Little Problem, Please try again!";
        }
        


  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What are you getting out, any errors, does it say theres a problem sending ?
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah thanks it gives this error:

    cannot send mail on localhost using port 25

  4. #4
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The mail function can only take lines of less than 70 chars long, therefore try wordwraping your message with newline after 65 chars.

    PHP Code:
    $body wordwrap($message65); 
    Also bear in mind the if you newline begins with a period, you need to double the char, from the manual

    Code:
    (Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot. <?php
    $text = str_replace("\n.", "\n..", $text);
    ?>
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  5. #5
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I think the problem has to do with the server configuration

    see i got this error after i specified the mail server using ini_set(); to specify the server name. Please I still need help

    PHP Code:
    SMTP server response504 <single14>: Helo command rejectedneed fully-qualified hostname in c:\sites\single14\segun\webroot\test.php on line 4 

  6. #6
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Error 504 is command parameter wrong, have you tried echoing out your

    $to
    $subject
    $body
    $from

    variables to make sure they contain valid data ?
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  7. #7
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by akbio2001 View Post
    see i got this error after i specified the mail server using ini_set(); to specify the server name. Please I still need help
    Are you saying it worked before you set the server name ?
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  8. #8
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it did not work before then, but after adding the server name; it stopped complaining about the server and the port.

  9. #9
    SitePoint Evangelist ldivinag's Avatar
    Join Date
    Jan 2005
    Location
    N37 33* W122 3*
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ummm... what email server are you using on that windows box?

    windows DOES NOT come with an email server...
    leo d.

  10. #10
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you looked at using a mailing library like Swift ?


Bookmarks

Posting Permissions

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