PHPMailer: Could not instantiate mail function.

Gestart doorDylan5 reacties43 weergaven

6 berichten · pagina 1 van 1

Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Ik krijg deze error als ik een mail wil verzenden: Could not instantiate mail function.
Code:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700]) {[/COLOR]
            
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vraag[/COLOR][COLOR= #007700]])) {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt geen vraag ingevuld <br />[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]=[/COLOR] false[COLOR= #007700];
            }[/COLOR]
            
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]filter_var[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]],[/COLOR] FILTER_VALIDATE_EMAIL[COLOR= #007700])) {[/COLOR]
                [COLOR= #FF8000]// true[/COLOR]
            [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Email is incorrect<br />[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]=[/COLOR] false[COLOR= #007700];
            }[/COLOR]
                
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]check[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt het formulier niet correct ingevuld <img src="http://www.one2xs.com/img/smileys/sadley.gif"> <br />[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]=[/COLOR] false[COLOR= #007700];
            }[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]!==[/COLOR] false[COLOR= #007700]) {[/COLOR]
                [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"mail/class.phpmailer.php"[/COLOR][COLOR= #007700]);[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]= new[/COLOR] PHPMailer[COLOR= #007700]();[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]IsHTML[COLOR= #007700]([/COLOR]true[COLOR= #007700]);[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]From [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]FromName [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]AddAddress[COLOR= #007700]([/COLOR][COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// Eerste geadresseerde[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]Subject [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Een vraag"[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]Body [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"
                
                Ewa,
                
                Naam: "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]" <br />
                Vraag: "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vraag[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]" <br />
                Email: "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]].[/COLOR] [COLOR= #DD0000]"<br />
                IP Adres: "[/COLOR][COLOR= #007700].[/COLOR]  [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ip[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]"
                "[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR][URL="http://www.php.net/WordWrap"]WordWrap[/URL] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]Send[COLOR= #007700]()){[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Er ging iets mis tijdens het versturen, namelijk:
                    "[/COLOR][COLOR= #007700];[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]->[/COLOR]ErrorInfo[COLOR= #007700];
                    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je vraag is succesvol verzonden."[/COLOR][COLOR= #007700];
                }
            }
         }[/COLOR] 
?>


Ik host dit script via XAMMP, ligt het hier aan? Of zit er een andere fout in?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
je verstuurt het dus infeite via de mail() functie.
Zorg dat je in php.ini een goed mailadres + SMTP ingevuld hebt (en restart apache)
0
Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Aarclay schreef:
je verstuurt het dus infeite via de mail() functie.
Zorg dat je in php.ini een goed mailadres + SMTP ingevuld hebt (en restart apache)
Welke SMPT server moet je hebben voor hotmail?

toevoeging op 29 juli 2012, 12:30:35:
Zelfde error:
Er ging iets mis tijdens het versturen, namelijk: Could not instantiate mail function.

PHP.ini:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.live.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = mijnemail@domein.nl


toevoeging op 29 juli 2012, 12:34:34:
Zou dit wel gewoon werken als ik dit script op een hosting server zet?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Er is ook een SMTP functie om direct een SMTP-server aan te spreken vanuit je script.
Op een goede hosting zal dit overigens wel direct werken. Vergeet de ; niet weg te halen voor de sendmail-from wink
0
Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Aarclay schreef:
Er is ook een SMTP functie om direct een SMTP-server aan te spreken vanuit je script.
Op een goede hosting zal dit overigens wel direct werken. Vergeet de ; niet weg te halen voor de sendmail-from wink
Op XAMMP werkt dit niet. zelfde error.

Maar op Versio werkt dit wel.

Werkt dit ook op een one2xs host?
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Eerdere citaten tonen
Aarclay schreef:
Er is ook een SMTP functie om direct een SMTP-server aan te spreken vanuit je script.
Op een goede hosting zal dit overigens wel direct werken. Vergeet de ; niet weg te halen voor de sendmail-from wink
Op XAMMP werkt dit niet. zelfde error.

Maar op Versio werkt dit wel.

Werkt dit ook op een one2xs host?
Normaal wel biggrin
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren