How can we help?

Help via Chat from monday to friday

Email contact form

In this article some examples of how to send emails using your website will be shown. These are usually used for contact forms in websites.

There are basically two different ways to send email messages from a website:

Local authentication: This method uses Umbler's host to send messages through Sendgrid. Specially useful for sending messages to the site's administrator and to some users.
In this case the only information needed will be the recipient, since the other info will be auto-generated by Umbler's server.

Using an external SMTP: This method uses an external SMTP server for authentication and delivery of messages. Any SMTP server can be used, like SendGrid or Google for example. It is recommended for websites that send a high amount of messages to clients. In this case, information like host, login, password and port need to be specified.

All messages sent through websites hosted at Umbler will be scanned by a local anti-spam filter, that will block messages identified as mail marketing, spam, phishing and other scams. Check out the Email Terms of Service. For email marketing practices we recommend using a third-party engine, like SendGrid, Mandrill or MailGun.


In this file only the field $email_to = 'email message recipient's address'; needs to be edited (keep the quotation marks).
$name = $_POST['name'];
//grabs the data from the NAME field.

$email = $_POST['email'];
//grabs the data from the EMAIL field.

$subject = $_POST['subject'];
//grabs the data from the SUBJECT field.

$message = $_POST['message'];
//grabs the data from the MESSAGE field.

$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";

/*Transmission configuration*/

$body = "Messages sent\n";
$body .= "Name: " . $name . "\n";
$body .= "Email: " . $email . "\n";
$body .= "Comments: " . $message . "\n";

$email_to = 'email message recipients address';
//DON'T FORGET to inform the recipient's mail address.

$status = mail($email_to, $subject, $body, $headers);
//Sending email.

if ($status) {
  echo "<script> alert('Message sent successfully!'); </script>";
//message successfully sent.

} else {
  echo "<script> alert('Error sending message.'); </script>";
//Error sending message. 


Sending an email message using an email account created at Umbler, or a third-party engine like SendGrid.

//Import the PHPMailer class into the global namespace

$mail = new PHPMailer();

// Defines SMTP

// SMTP external Host, like SendGrid.
$mail->Host = "";

// Authentication | True
$mail->SMTPAuth = true;

// User SMTP Server
$mail->Username = '';

// email password
$mail->Password = 'pass';

$mail->From = "";
$mail->FromName = "Sender's Name";
$mail->AddAddress('', 'Recipients name');

// email message will be sent formatted as HTML

// Charset (optional)
$mail->CharSet = 'iso-8859-1';

// message's subject
$mail->Subject = "Test message";

// content of the mail message
$mail->Body = 'Content of the message';

// content of the mail message (plain text)
$mail->AltBody = 'Content of the message';

// Transmission of the message
$sent = $mail->Send();


if ($sent) {
  echo "E-mail sent successfully!";
} else {
  echo "It was not possible to deliver the mail message.";
  echo "Error: " . $mail->ErrorInfo;