entre Desarrolladores

Recibe ayuda de expertos

Registrate y pregunta

Es gratis y fácil

Recibe respuestas

Respuestas, votos y comentarios

Vota y selecciona respuestas

Recibe puntos, vota y da la solución

Pregunta

1voto

Opciones para invocar cliente de email en HTML

Tengo el siguiente enlace para enviar un email:

<a href="mailto:[email protected]"> Enviar un saludo</a>

¿Es posible predefinir un título y cuerpo del email?

2 Respuestas

2votos

Peter Puntos150460

Sí, agregando los parámetros subject y body, por ejemplo:

<a href="mailto:[email protected]?subject=Hola&body=Solo para saludar"> Enviar saludo </a>

2votos

jorgepm Puntos520

Con JQUERY

    <script type='text/javascript'>
$(document).ready(function() {
$('a.hide_email').each(function() {
var to_front = $(this).attr('to_front');
var to_back = $(this).attr('to_back');
var to_subject =$(this).attr('to_subject');
var to_body = $(this).attr('to_body');
var to_cc_front = $(this).attr('to_cc_front');
var to_cc_back = $(this).attr('to_cc_back');
var to_bcc = $(this).attr('to_bcc');
var to_bcc_front = $(this).attr('to_bcc_front');
var to_bcc_back = $(this).attr('to_bcc_back');
var to_showemail = $(this).attr('to_showemail');
var href = 'mailto:';
var email;
var vars = Array();
var varCount = 0;
if(to_front ){
email = to_front 
href = href + email ;
$(this).removeAttr('to_front');
if(to_subject){
vars[varCount] = 'subject=' + to_subject;
varCount++;
$(this).removeAttr('to_subject');
}
if(to_body){
vars[varCount] = 'body=' + to_body;
varCount++;
$(this).removeAttr('to_body');
}
if(to_cc_front && to_cc_back){
vars[varCount] = 'cc=' + to_cc_front + '@' + to_cc_back;
varCount++;
$(this).removeAttr('to_cc_front');
$(this).removeAttr('to_cc_back');
}
if(to_bcc_front && to_bcc_back){
vars[varCount] = 'bcc=' + to_bcc_front + '@' + to_bcc_back;
varCount++;
$(this).removeAttr('to_bcc_front');
$(this).removeAttr('to_bcc_back');
}
if(to_bcc){
vars[varCount] = 'bcc=' + to_bcc;
varCount++;
$(this).removeAttr('to_bcc');
}
if(varCount > 0){
href = href + '?' + vars.join('&');
}
$(this).attr( 'href' , href );
if(to_showemail == 'true'){
$(this).html(email);
$(this).removeAttr('to_showemail');
}
}
});
});
</script>

y para enviarlo

 <a class=\"hide_email\" to_front=\'"+ getSessionValue(request, "eMail") +"'\" to_back=\"gmail.com\" to_bcc=\'" + bcc + "'\">'" + bcc + "'</a>

Por favor, accede o regístrate para responder a esta pregunta.

Otras Preguntas y Respuestas


...

Bienvenido a entre Desarrolladores, donde puedes realizar preguntas y recibir respuestas de otros miembros de la comunidad.

Conecta