Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

85
Visualizações
how can i get this javascript to work? how to set up a carbon copy gmail?

basically, ive been trying to set up this code for my page, however im struggling as im not the best at javascript. ive tried looking up resources online but none of them seem to help. this is part of a form, i want the users to fill a small form and then, after clicking the button, it should open their mail client with a template. i just need to know how to properly add the information to the javascript, especially how to set up a carbon copy gmail, and if theres anything i should change. i can provide the full form code if needed.

<div class="row">
<input type="submit" value="Enviar." onclick="sendMail(); return false">
</div>

heres the javascript that ive been working with

<script>

function sendMail() {
    var link = "mailto:me@example.com"
             + "?cc=myCCaddress@example.com"
             + "&subject=" + encodeURIComponent("This is my subject")
             + "&body=" + encodeURIComponent(document.getElementById('myText').value)
    ;
    
    window.location.href = link;
}

</script>
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

mailto is one of many URL Protocols and it's a way for commands to exit the browser and interact with other applications.

you can try this URL API

https://mail.google.com/mail/?view=cm&fs=1&to=[to]&cc=[cc]&bcc=[bcc]&su=[subject]&body=[body]

Although not recommended. Anyone who clicks on it needs to be logged into their gmail account (if they have one), but technically it works if the user has gmail and is logged in.

here is an example on how to combine urls

const combination = (obj) => {
  const parameter = Object.entries(obj).map(o => `&${o[0]}=${o[1]}`).join('');
  return `https://mail.google.com/mail/?view=cm&fs=1${parameter}`
};

const mail1 = {
  su: 'subject',
  to: 'someone',
  body: 'body',
  cc: 'someone',
  bcc: 'someone'
}

const mail2 = {
  su: 'subject',
  to: 'someone',
  body: 'body'
}

console.log('mail1', combination(mail1));
console.log('mail2', combination(mail2));

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda