===== VoiceXML Example : Record and POST a message =====
**Record message to mail**
SMTPDebug =true;
// Now you only need to add the necessary stuff
$mail->IsSMTP();
//$mail->SMTPAuth = true; // enable SMTP authentication
//$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
//$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
//$mail->Port = 465; // set the SMTP port for the GMAIL server
//$mail->Username = "name@gmail.com"; // GMAIL username
//$mail->Password = "xxxxxx"; // GMAIL password
//$mail->AddReplyTo("name@gmail.com", "First Last");
//$mail->Host = "smtp.free.fr"; // sets GMAIL as the SMTP server
//$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->From = "marketing@domain.com";
$mail->FromName = "Ulex.fr";
$mail->AddAddress("borja.sixto@domain.com", "Borja");
$mail->AddAddress("marketing@ulex.fr", "Ulex.fr");
$mail->Subject = "Message : from ".$caller." to Ulex.fr";
$mail->Body = "A file is attached ("."mp3".")\n";
$mail->AddAttachment($outfile, $caller.".mp3");
if(!$mail->Send())
{
readfile("error.vxml");
exit;
}
}
}
readfile("goodbye.vxml");
?>
The VoiceXML browser will record a message and post it with multipart encoding.
The PHP script get the recording, convert it locally to MP3 and send an email with the audio file attached.
Download :
[[http://downloads.voximal.com/vxml_examples/messagebox/record.vxml|record.vxml]]
[[http://downloads.voximal.com/vxml_examples/messagebox/send.php.txt|send.php]]