Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Why does not work the class Email in a WAMP server?


Go to End


4 Posts   1070 Views

Avatar
Josua

Community Member, 87 Posts

10 February 2012 at 9:31am

Edited: 10/02/2012 9:31am

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'));
}

Avatar
Josua

Community Member, 87 Posts

13 February 2012 at 9:57pm

Hi!

Does anyone have any ideas about this?

Regards,
Jose A.

Avatar
swaiba

Forum Moderator, 1899 Posts

13 February 2012 at 10:53pm

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.

Avatar
Josua

Community Member, 87 Posts

14 February 2012 at 1:49am

swaiba, you are wonderful. :)
Your solution works perfectly.

Thank you very much.

Regards,
Jose A.