I use simple php to process sending form inputs arrays using localhost server. Now I need to switch to defined mail server like Gmail SMTP to handle sending process.
<?php
$to = "contact@mail.com";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$headers = "From: $from";
$subject = "[Contact form] You have a message from $name.";
$fields = array();
$fields{"name"} = "Name";
$fields{"email"} = "Email";
$fields{"phone"} = "Phone";
$fields{"department"} = "Department";
$fields{"message"} = "Message";
$body = "Here is what was sent:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$send = mail($to, $subject, $body, $headers);
?>
With mail(), you can't.
Use for example: SwiftMailer. Example:
See this: http://swiftmailer.org/docs/sending.html