Bueno, por si las moscas, os pongo el código de envío de mail
Send_data.php:
Código PHP:
<?php
include ('conexion.php');
// Editar las próximas dos líneas de código de acuerdo con las preferencias
$email_to = "[email protected]";
$email_subject = "Service Software Configuration ";
$error = FALSE;
//Evaluamos OwnerShip
$rbOwnership = $_POST ['ownership'];
// Evaluamos los checkbox
$chkefpcms_r = $_POST ['efpcms_r'];
$chkefpcms_s = $_POST ['efpcms_s'];
$chkef_ept_icd = $_POST ['ef_ept_icd'];
$chkef_cpt_icd = $_POST ['ef_cpt_icd'];
$chkef_core = $_POST ['ef_core'];
$chkASTA = $_POST ['ASTA'];
$chkOGSE_IVS = $_POST ['OGSE_IVS'];
$chkGSS_Security = $_POST ['GSS_Security'];
$chkATLANTE_DOORS = $_POST ['ATLANTE_DOORS'];
$chkother = $_POST ['otherchk'];
$chkothertxt = $_POST ['othertxt'];
//Evaluamos si ha aceptado las condiciones
$rbAgree = $_POST ['agree'];
// Aquí se deberían validar los datos ingresados por el usuario. Lo podemos omitir porque se ha realizado la comprobación antes de pasar a la funcion
// Ahora se envía el e-mail usando la función mail() de PHP
$headers = 'From: ' . $email_from . "\r\n" . 'Reply-To: ' . $email_from . "\r\n" . 'X-Mailer: PHP/' . phpversion ();
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";
$email_message = "Details contact form:\n\n";
$email_message .= "Ownership: " . $_POST ['ownership'] . "\n";
$email_message .= "User id: " . $_POST ['user_id'] . "\n";
$email_message .= "Name: " . $_POST ['first_name'] . "\n";
$email_message .= "Apellido: " . $_POST ['family_name'] . "\n";
$email_message .= "E-mail: " . $_POST ['email'] . "\n";
$email_message .= "Unit: " . $_POST ['unit'] . "\n";
$email_message .= "Department: " . $_POST ['dept'] . "\n";
$email_message .= "Affiliation: " . $_POST ['affiliation'] . "\n";
$email_message .= "PC Name: " . $_POST ['hostname'] . "\n";
$email_message .= "Programme: " . $_POST ['programme'] . "\n";
$email_message .= "CASA Address: " . $_POST ['address'] . "\n\n";
$email_message .= "Telephone: " . $_POST ['phone'] . "\n";
$email_message .= "Fax: " . $_POST ['fax'] . "\n";
if ($chkefpcms_r == "yes") {
$email_message .= "Access Required: " . $_POST ['efpcms_r'] . "\n";
}
if ($chkefpcms_s == "yes") {
$email_message .= "Access Required: " . $_POST ['efpcms_s'] . "\n";
}
if ($chkef_ept_icd == "yes") {
$email_message .= "Access Required: " . $_POST ['ef_ept_icd'] . "\n";
}
if ($chkef_cpt_icd == "yes") {
$email_message .= "Access Required: " . $_POST ['ef_cpt_icd'] . "\n";
}
if ($chkef_core == "yes") {
$email_message .= "Access Required: " . $_POST ['ef_core'] . "\n";
}
if ($chkASTA == "yes") {
$email_message .= "Access Required: " . $_POST ['ASTA'] . "\n";
}
if ($chkOGSE_IVS == "yes") {
$email_message .= "Access Required: " . $_POST ['OGSE_IVS'] . "\n";
}
if ($chkGSS_Security == "yes") {
$email_message .= "Access Required: " . $_POST ['GSS_Security'] . "\n";
}
if ($chkATLANTE_DOORS == "yes") {
$email_message .= "Access Required: " . $_POST ['AS'] . "\n";
}
if ($chkother == "yes") {
$email_message .= "Access Required: " . $_POST ['otherchk'] . "\n";
$email_message .= "Other Text: " . $_POST ['othertxt'] . "\n";
}
$email_message .= "Responsible Name: " . $_POST ['responsible'] . "\n";
$email_message .= "Responsible Email: " . $_POST ['respmail'] . "\n";
$email_message .= "Description \"Need to know\": " . $_POST ['description'] . "\n";
if ($rbAgree == "yes") {
$email_message .= "Agree Conditions: " . $_POST ['agree'] . "\n";
}
mail ( $email_to, $email_subject, utf8_decode($email_message), $headers)
or die ("No se ha podido enviar tu mensaje. Ha ocurrido un error") ;
echo "<p>Tu mensaje a sido enviado con este contenido:</p>" ;
?>
Conexion.php
Código PHP:
<?php
$link = @mysql_conect("10.0.0.7","yyyyyy","xxxxx")
or die ("ERROR al realizar la conexión de la base de datos.");
@mysql_select_db("exampledb",$link)
or die("ERROR al conectar a la Base de Datos");
?>