Results 1 to 11 of 11

Thread: Using htmlMimeMail5 for sending emails

  1. #1

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Using htmlMimeMail5 for sending emails

    I am trying to get to send email from my development machine, which is pretty much the same setup than the new server (Windows, Apache, PHP5, MySQL...using WampServer).

    My own email (which I use for development), and the company email (for which I still need the smtp details..i'm new here), are hosted by seperate companies abroad in UK.

    I want to perform various actions such as sending html emails, etc, and as I am not a PHP expert, I did some research, and using htmlMimeMail5 looks like a good package to use for this.

    However I am having problems to get this work.
    Let's say my own email details are as follows:
    SMTP server: authsmtp.streamline.net
    SMTP username: [email protected]
    SMTP password: 1234
    SMTP port: 25

    Apparently first thing I had to do was to change these lines in my php.ini, which I did (and yes, restarted all services):
    Code:
    [mail function]
    ; For Win32 only.
    SMTP = authsmtp.streamline.net;
    
    ; For Win32 only.
    sendmail_from = [email protected];
    For htmlMimeMail5, I could not find documentation about what to change, but I changed the following:
    Code:
            * Defaults for smtp sending
            */
            if (!empty($_SERVER['HTTP_HOST'])) {
                $helo = $_SERVER['HTTP_HOST'];
    
            } elseif (!empty($_SERVER['SERVER_NAME'])) {
                $helo = $_SERVER['SERVER_NAME'];
            
            } else {
                $helo = 'authsmtp.streamline.net';
            }
    
            $this->smtp_params['host'] = 'authsmtp.streamline.net';
            $this->smtp_params['port'] = 25;
            $this->smtp_params['helo'] = $helo;
            $this->smtp_params['auth'] = false;
            $this->smtp_params['user'] = '[email protected]';
            $this->smtp_params['pass'] = '1234';
    However, I still get this error:
    Code:
    Warning: mail() [function.mail]: SMTP server response: 551 User not local; please try <forward-path> in C:\wamp\www\lab\email\htmlMimeMail5.php
    While I am at it. Am I missing something, or why is it such a hassle to send a html email via an external smtp server? Does not really make sense to me.
    Last edited by StrangerInBeijing; Oct 30th, 2007 at 08:37 PM.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Using htmlMimeMail5 for sending emails

    Do those authentication details work when using a desktop email client?


    Also, I really don't recommend using HTML in emails if you don't have to.

  3. #3

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Using htmlMimeMail5 for sending emails

    Yes, it's the same settings I use in outlook.

  4. #4

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Using htmlMimeMail5 for sending emails

    OK, let me re-phrase, and sound like the noob I am.

    If you want to send emails from your php website (I use windows, apache, php5, mysql) under the following conditions, which is the "easiest" or "best" way to go ahead:
    1) You will use an SMTP host
    2) The body of the mail will be HTML

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Using htmlMimeMail5 for sending emails

    The documentation page for the mail function recommends PEAR::Mail_Mime for creating complex messages.

    Ensure that you can send plain text emails using those authentication settings. If it only bombs out on HTML messages, then that is a quirk of the SMTP server.

  6. #6

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Using htmlMimeMail5 for sending emails

    uuuurgh, getting tired of this one..
    going to look into this Pear MIME mail thing now, because even after I set the php.ini file's smtp settings, and use the following simplest form of code, i get told there's an error on the line where i send the mail...(and yes, I use valid email address and smtp host)
    Code:
    <?php
    $headers = "From: Nico Nel <[email protected]>\r\n";
    $headers .= 'To: Nico Nel <[email protected]>'."\r\n";
    mail("[email protected]","test","test message",$headers);
    ?>
    Warning: mail() [function.mail]: SMTP server response: 555 Syntax error in E:\www\studypath\usr\recover.php on line 4
    Last edited by StrangerInBeijing; Nov 2nd, 2007 at 02:49 AM.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Using htmlMimeMail5 for sending emails

    Sounds like a temperamental server. Have you tried another?

  8. #8

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Using htmlMimeMail5 for sending emails

    i guess i should try my own website hosted with streamline.net. they pretty good and stable.
    Trying phpmailer right now (yeah yeah, i'm new and playing around),and even that fail with a "Message was not sent.Mailer error: SMTP Error: Data not accepted. " error. uurgh

    If trying my own host, one question: my email settings for my host is not like mail.site.com, but authsmtp.streamline.net for smtp server. Guess I must use that right?

    What bugs me is that none of this code ask for the account password. Does not make sense..mean you write code that send emails from someone else's email, if you know their host mail server name.

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Using htmlMimeMail5 for sending emails

    Yes; in fact, you can pretend to be anyone, using any SMTP server you like.

  10. #10

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Using htmlMimeMail5 for sending emails

    Quote Originally Posted by penagate
    Yes; in fact, you can pretend to be anyone, using any SMTP server you like.
    thats news...*EVIL GRIN*

  11. #11

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Using htmlMimeMail5 for sending emails

    ok, still dont get it right......this is what I've done:
    in my php.ini i did this:
    uncomment extension=php_smtp.dll (dont know why..just did it)
    set following
    Code:
    [mail function]
    ; For Win32 only.
    SMTP = authsmtp.streamline.net
    ; For Win32 only.
    sendmail_from = [email protected];
    and then used following code using phpmailer:
    Code:
      require("class.phpmailer.php");
      $mail = new PHPMailer();
      $mail->IsSMTP(); // telling the class to use SMTP
      $mail->Host = "authsmtp.streamline.net"; // SMTP server
      $mail->From = "[email protected]";
      $mail->AddAddress("[email protected]");
      
      $mail->Subject = "First PHPMailer Message";
      $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
      $mail->WordWrap = 50;
      
      if(!$mail->Send())
      {
         echo 'Message was not sent.';
         echo 'Mailer error: ' . $mail->ErrorInfo;
      }
      else
      {
         echo 'Message has been sent.';
      }
    and then i get this lovely error:
    Code:
    Message was not sent.Mailer error: SMTP Error: The following recipients failed: [email protected]
    I guess I can spend the rest of the weekend figuring out the PEAR MIME thing, but then, if i can get *this* working, how would anytihng else work?

    I'm running all this from my local machine....will try upload and run it from live server, but doubt that will change anything

    ADDED: Just tried on live server...edited (the right) php.ini, etc....exact same bloody error
    Last edited by StrangerInBeijing; Nov 2nd, 2007 at 04:09 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width