Jump to:

23480 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Why does not work the class Email in a WAMP server?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 514 Views
  • Josua
    Avatar
    Community Member
    86 Posts

    Why does not work the class Email in a WAMP server? Link to this post

    Hi!

    The mail function works perfectly on the WAMP server, but the Email class does not send the message.

    What is happening?
    Do I have to setup something more in the Email class?

    The same code, in a server remote works perfectly.

    Regards,
    Jose A.

    php.ini (WAMP server)
    [mail function]
    ; For Win32 only.
    ; http://php.net/smtp
    SMTP = mail.dominiox.com
    ; http://php.net/smtp-port
    smtp_port = 25

    public function sendemail($data, $form){
          if(!empty($this->Mailto)){
             $email = $this->Mailto;
          } else {
             $email = EMAIL;
          }

    $headers = 'MIME-Version: 1.0'. "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: sender@sender.com' . "\r\n";
    mail("info@dominiox.com","test subject","test body",$headers);

          $from = $data['Email'];
          $to = $email;
          $subject = $this->subject;
          $email = new Email($from, $to, $subject);
          $email->setTemplate('Email');
          $email->populateTemplate($data);
          $email->send();

          Director::redirect($this->Link('sent'));
       }

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: Why does not work the class Email in a WAMP server? Link to this post

    Hi!

    Does anyone have any ideas about this?

    Regards,
    Jose A.

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: Why does not work the class Email in a WAMP server? Link to this post

    As I recall I used soemthing like this...
    http://www.joshstauffer.com/send-test-emails-with-wampserver/

    Now I don't, instead I have a debug log (in the db) and when on localhost send all email there... there were some emails sent that I didn't want to be.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: Why does not work the class Email in a WAMP server? Link to this post

    swaiba, you are wonderful.
    Your solution works perfectly.

    Thank you very much.

    Regards,
    Jose A.

    514 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.