Skip to content

Cookie settings

Choose which kinds of cookies you allow. You can change your choice at any time via Cookie settings at the bottom of every page. Privacy statement

Necessary

Always on

Needed to log in, keep your cart and remember your choices. These are always on.

Which cookies?
  • weboke_sessie, weboke_klant, weboke_remember: your session and staying logged in
  • weboke_basket: your cart
  • wkBtwIncl: showing prices with or without VAT
  • wok_cookies: your cookie choice, 12 months

Measures which ad leads to a visit or order, so we do not pay for ads that do nothing.

Which cookies?
  • Google Ads via Google Tag Manager (_gcl_au, _gcl_aw), up to 90 days
  • OpenAI Ads, ads in ChatGPT
  • wok_aff: which partner referred you to us (affiliate programme), 60 days

4.6

How do I get the correct sender with mail() in PHP? SMTP

If you use PHP's mail() function, the sender will be accountname@yourdomain.xx. This cannot be changed and will cause errors or result in the email being treated as spam.
It is best to use SMTP. There are many free PHP classes for this available online. The email is then sent via SMTP and the sender can easily be set.

A popular option is PHPMailer

You can also use PEAR Mail to send email directly via SMTP. This is especially useful for forms or custom scripts.

https://pear.php.net/package/Mail
https://pear.php.net/package/Net_SMTP
https://pear.php.net/package/Auth_SASL

Example: sending SMTP mail with PEAR

<?php

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);

// PEAR Mail laden
require_once 'Mail.php';

// SMTP-instellingen
$smtp_host = 'ssl://mail.server.tld';
$smtp_port = 465;
$smtp_user = 'user@domein.nl';
$smtp_pass = 'wachtwoord';

// E-mailgegevens
$to      = 'ontvanger@domein.nl';
$from    = 'user@domein.nl';
$subject = 'Testbericht';
$body    = 'Dit is een testmail verzonden via SMTP.';
$reply   = 'user@domein.nl';

// Headers
$headers = array(
    'From'      => $from,
    'To'        => $to,
    'Subject'   => $subject,
    'Reply-To'  => $reply
);

// SMTP object
$smtp = Mail::factory('smtp', array(
    'host'     => $smtp_host,
    'port'     => $smtp_port,
    'auth'     => true,
    'username' => $smtp_user,
    'password' => $smtp_pass
));

// Mail verzenden
$result = $smtp->send($to, $headers, $body);

if (PEAR::isError($result)):
    echo $result->getMessage();
else:
    echo 'E-mail succesvol verzonden';
endif;

 

 

Was this article helpful?

← Back to Email

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…