Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem sending mail with Email Package
  • Hello,
    I try to send an email with the Email Package.

    I have always_loaded it in the config.
    Here is my email config:
    http://bin.fuelphp.com/snippet/view/sF
    My sendmail lives in C:\xampp\sendmail (Windows)

    To test sending mails I have created the following action_mail:
    http://bin.fuelphp.com/snippet/view/sG

    When I let this run, I receive an error:
      (Object #74): Email\EmailSendingFailedException 

        protected message (String): "Failed sending email" (20 characters)
        protected code (Integer): 0
        protected file (String): "C:\xampp\htdocs\fuel17\fuel\packages\email\classes\email\driver\mail.php" (72 characters)
        protected line (Integer): 33

    What exactly does this error mean and what did I make wrong?
    Thanks for your support.
    Best wishes
    Kay

  • You're using the "mail" driver, which uses the PHP function mail() to send out the mail, and it is that function that fails. If you want to see the exact error, you can remove the @ in front of it, on line 31.

    It probably means your php.ini is not properly configured for your sendmail.
  • ok, I have changed my php.ini to

    [mail function]
    SMTP = smtp.hoteldatenservice.de
    smtp_port = 25
    username = backend@hotelwebservice.de
    password = xxxxxx
    sendmail_from = backend@hotelwebservice.de

    When sending a mail to the "same" domain it is working now.
    If I try so send a mail to another domain, I'll receive this error:

    Fuel\Core\PhpErrorException [ Warning ]:
    mail() [function.mail]: SMTP server response: 554 5.7.1 <skater26do@gmx.de>: Relay access denied

    I have found that I need to set also username and password for php.ini, which I did. But still get this error. If I send a mail to that adress via Thunderbird this is working perfectly.

    Do you have any idea what causes this???

    Thanks
    Kay

  • what is the sender on that message?

    "Relay access denied" is a mailserver error that says "source is not allowed to send to destination".

    with mail(), if you don't take special measures, mail is being send from <apache@your-server-name>, which might be the problem here. I think this is documented in the PHP manual.
  • Personally I never use mail(), I always run a local sendmail service, and configure the Email package to use the sendmail driver, delivering to localhost. Saves a lot of hassle. Not sure how you would do that on Windows though, I don't use that.
  • Here is what my php_mail.log says:

    mail() on [C:\xampp\htdocs\fuel17\fuel\packages\email\classes\email\driver\mail.php:31]: To: Testuser <skater26do@gmx.de> -- Headers: Date: Sun, 03 Nov 2013 11:04:30 +0100 Return-Path: backend@hoteldatenservice.de From: HDS Backend <backend@hoteldatenservice.de> Message-ID: <52761faed00a3@hoteldatenservice.de> X-Priority: 3 (Normal) X-Mailer: FuelPHP, PHP 5.3 Framework MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"
    mail() on [C:\xampp\htdocs\fuel17\fuel\packages\email\classes\email\driver\mail.php:31]: To: Testuser <skater26do@gmx.de> -- Headers: Date: Sun, 03 Nov 2013 11:05:54 +0100 Return-Path: backend@hoteldatenservice.de From: HDS Backend <backend@hoteldatenservice.de> Message-ID: <5276200271bf8@hoteldatenservice.de> X-Priority: 3 (Normal) X-Mailer: FuelPHP, PHP 5.3 Framework MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"
    mail() on [C:\xampp\htdocs\fuel17\fuel\packages\email\classes\email\driver\mail.php:31]: To: Testuser <skater26do@gmx.de> -- Headers: Date: Sun, 03 Nov 2013 11:08:59 +0100 Return-Path: backend@hoteldatenservice.de From: HDS Backend <backend@hoteldatenservice.de> Message-ID: <527620bb119e9@hoteldatenservice.de> X-Priority: 3 (Normal) X-Mailer: FuelPHP, PHP 5.3 Framework MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"
    mail() on [C:\xampp\htdocs\fuel17\fuel\packages\email\classes\email\driver\mail.php:31]: To: Testuser <skater26do@gmx.de> -- Headers: Date: Sun, 03 Nov 2013 11:10:07 +0100 Return-Path: backend@hoteldatenservice.de From: HDS Backend <backend@hoteldatenservice.de> Message-ID: <527620ff2258e@hoteldatenservice.de> X-Priority: 3 (Normal) X-Mailer: FuelPHP, PHP 5.3 Framework MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"


    With sendmail_from = backend@hotelwebservice.de normally I should tell mail() to use this adress as sender, right?


  • HarroHarro
    Accepted Answer
    I don't know. The log seems ok. It could also be that your smtp server has a relay list defined based on IP, and the IP of your (test?) webserver is not allowed to relay?

    mail() [function.mail]: SMTP server response: 554 5.7.1 <skater26do@gmx.de>: Relay access denied

    is a response message from the mail server, so if you're sure from: and to: on your message are correct, the problem is in the configuration of this mail server.
  • He setup SMTP not sendmail

    c:\xampp\php\php,ini

    ; For Win32 only.
    sendmail_from = postmaster@localhost

    c:\xampp\sendmail\sendmail.ini

    Read the ReadMe.html file and look at the example sendmail_example.ini

  • I found a misconfiguration in the mailserver.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion