Results 1 to 5 of 5

Thread: Server / Email Madness

  1. #1

    Server / Email Madness

    So I've just started moving a large project from a testing server, to what will eventually be the live server.

    Part of the application involves sending an HTML email to users who have completed certain tasks.

    I am currently constructing and sending the email as follows:

    PHP Code:
    $email_sender "Broker King";
    $email_subject "Thank You For Playing";        
    $message "<html>
      <body>
      <img src='http://www.duncanhall.net/pacmini/logo.jpg' />
      <br><br><br>
      <font face='tahoma' size='2'>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum eu orci. 
        Cras non lectus. Fusce tincidunt. Etiam lacinia interdum tellus. Ut mi odio, 
        rutrum quis, molestie in, lacinia sit amet, sapien. In ultrices lectus in diam. 
        Vestibulum leo urna, hendrerit ac, facilisis sed, scelerisque ac, enim. 
        Suspendisse ipsum mi, posuere pellentesque, commodo quis, ultrices et, urna. 
        Fusce leo. Duis diam.
        <br><br>
        TEST TEST TEST <b>TEST IN BOLD</b>
        <br><br><br>
        <b>BROKER KING<b>
        </font>
      </body>
    </html>"
    ;

    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers  .= "From: $email_sender\r\n";

    mail("myEmail@someDomain.com"$email_subject$message$headers); 
    This has worked perfectly on the testing server, which is running Apache on a Linux machine. However, on the new server (IIS on Windows), the email simply isn't sent (and no errors are returned).

    I know that it has mail capabilites because I can successfully send simple, standard email from both servers in the form:

    PHP Code:
    <?php    
            $email_sender 
    "somebody";
            
    $email_subject "testing...";        
            
    $email_message "This email will be sent";        

            
    mail("myEmail@someDomain.com"$email_subject$email_message"From: this@that.net");
    ?>
    Does anyone know of any reason why the first example cannot be sent by both servers?

    I would muchly appreciate any help on this.

  2. #2
    Solved - the SMTP server wasn't accepting the "From" address.

  3. #3

  4. #4
    Exactly the same as the first block of code, except the first variable is:

    PHP Code:
    $email_sender "something@somewhere.com"
    I was half way through installing phpMailer to see if that would sort the problem out, when I read this in the documentation:

    "For SMTP, you need a valid smtp server. This, for example, is your working one from your mail client. Working one means, the from email address should be accepted by the smtp server. If not, sending the mail out will fail....".

    So I took I guess that that might be my problem, and it's done the trick.

  5. #5

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012