如何通过代码发送谷歌议程邀请?



我正试图通过日历应用程序发送邀请电子邮件,我一直在php中做,是否有可能通过代码以任何方式做到这一点?任何框架都会为我工作,我使用javascript和ajax,我想过用python自动化pyauotgui来做,但我一直想知道是否没有一个代码解决方案,提前感谢你们所有人

我的代码如下:

document.addEventListener("DOMContentLoaded", function() {
var modal = document.getElementById('meumodal')
var fechar = document.getElementById('fecharmodal')



//abrir o modal
document.addEventListener.onclick = function OpenModal(){ 
modal.style.display = 'block'
}
})

function showModal(valorhora){
var element = document.getElementById('modal');
element.classList.add("show-modal")
var hora = valorhora;
let horariodecomeco = document.querySelector(".horario-inicio")
horariodecomeco.value = hora;
horariodecomeco.innerHTML = hora;
}

function registraDados(BtAgendar){
var NomeSolicitante = document.getElementById('NomeSolicitante')
NomeSolicitante = NomeSolicitante.value
alert(NomeSolicitante)
var EmailSolicitante = document.getElementById('EmailSolicitante')
EmailSolicitante = EmailSolicitante.value
alert(EmailSolicitante)
}


function hideModal(){
var element = document.getElementById('modal')
element.classList.remove('show-modal')
}

/*reconhecer valor do botão e mudar cor*/
function clickMouse(hora) {
let horariodecomeco = document.querySelector("#horario-inicio")
horariodecomeco += hora;
switch(hora){
case "07:00":
document.getElementById('btnHora').style.background = "red";
document.getElementById('btnHora').innerHTML = 'Agendado';
document.getElementById('btnHora').disabled = true;
break;
case "07:30":
document.getElementById('btnHora1').style.background = "red";
document.getElementById('btnHora1').innerHTML = 'Agendado';
document.getElementById('btnHora1').disabled = true;
break;
case "08:00":          
document.getElementById('btnHora2').style.background = "red";
document.getElementById('btnHora2').innerHTML = 'Agendado';
document.getElementById('btnHora2').disabled = true;
break;
case "08:30":
document.getElementById('btnHora3').style.background = "red";
document.getElementById('btnHora3').innerHTML = 'Agendado';
document.getElementById('btnHora3').disabled = true;
break;
case "09:00":
document.getElementById('btnHora4').style.background = "red";
document.getElementById('btnHora4').innerHTML = 'Agendado';
document.getElementById('btnHora4').disabled = true;
break;
case "09:30":
document.getElementById('btnHora5').style.background = "red";
document.getElementById('btnHora5').innerHTML = 'Agendado';
document.getElementById('btnHora5').disabled = true;    
break;
case "10:00":
document.getElementById('btnHora6').style.background = "red";
document.getElementById('btnHora6').innerHTML = 'Agendado';
document.getElementById('btnHora6').disabled = true;
break;
case "10:30":
document.getElementById('btnHora7').style.background = "red";
document.getElementById('btnHora7').innerHTML = 'Agendado';
document.getElementById('btnHora7').disabled = true;
break;
case "11:00":
document.getElementById('btnHora8').style.background = "red";
document.getElementById('btnHora8').innerHTML = 'Agendado';
document.getElementById('btnHora8').disabled = true; 
break;
case "11:30":
document.getElementById('btnHora9').style.background = "red";
document.getElementById('btnHora9').innerHTML = 'Agendado';
document.getElementById('btnHora9').disabled = true; 
break;
case "12:00":
document.getElementById('btnHora10').style.background = "red";
document.getElementById('btnHora10').innerHTML = 'Agendado';
document.getElementById('btnHora10').disabled = true;
break;
case "12:30":
document.getElementById('btnHora11').style.background = "red";
document.getElementById('btnHora11').innerHTML = 'Agendado';
document.getElementById('btnHora11').disabled = true;
break;
case "13:00":
document.getElementById('btnHora12').style.background = "red";
document.getElementById('btnHora12').innerHTML = 'Agendado';
document.getElementById('btnHora12').disabled = true; 
break;  
case "13:30":
document.getElementById('btnHora13').style.background = "red";
document.getElementById('btnHora13').innerHTML = 'Agendado';
document.getElementById('btnHora13').disabled = true; 
break;
case "14:00":
document.getElementById('btnHora14').style.background = "red";
document.getElementById('btnHora14').innerHTML = 'Agendado';
document.getElementById('btnHora14').disabled = true; 
break;
case "14:30":
document.getElementById('btnHora15').style.background = "red";
document.getElementById('btnHora15').innerHTML = 'Agendado';
document.getElementById('btnHora15').disabled = true; 
break;
case "15:00":
document.getElementById('btnHora16').style.background = "red";
document.getElementById('btnHora16').innerHTML = 'Agendado';
document.getElementById('btnHora16').disabled = true; 
break;
case "15:30":
document.getElementById('btnHora17').style.background = "red";
document.getElementById('btnHora17').innerHTML = 'Agendado';
document.getElementById('btnHora17').disabled = true; 
break;
case "16:00":
document.getElementById('btnHora18').style.background = "red";
document.getElementById('btnHora18').innerHTML = 'Agendado';
document.getElementById('btnHora18').disabled = true; 
break;
case "16:30":
document.getElementById('btnHora19').style.background = "red";
document.getElementById('btnHora19').innerHTML = 'Agendado';
document.getElementById('btnHora19').disabled = true; 
break;
}

}
function clearParticipante(){
let NovoParticipante = document.querySelector(".CamposConvidados");
let CampoParticipante = '<div class="Linha-Convidado"><div class="Titulo">Nome convidado</div><div class="Caixa-Texto"><input type="text" class="convidado"></div><div class="Titulo">E-mail convidado</div><div class="Caixa-Texto"><input type="text" class="emailconvidado"</div></div>'
NovoParticipante.innerHTML = CampoParticipante;
}
function AdicionandoParticipante() {
let NovoParticipante = document.querySelector(".CamposConvidados");
let CampoParticipante = '<div class="Linha-Convidado"><div class="Titulo">Nome convidado</div><div class="Caixa-Texto"><input type="text" name ="nome_convidado" class="convidado"></div><div class="Titulo">E-mail convidado</div><div class="Caixa-Texto"><input type="text" name="email_convidado"  class="emailconvidado"</div></div>'
NovoParticipante.innerHTML += CampoParticipante;
}
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="Style/Agenda.css">
<title>Reserva de Sala de Reunião</title>
</head>
<body>
<div class="content">
<section class="info">
<header>
<h1>Rua alberto de nobrega</h1>
<span>Sala <?php echo $numerosala ?></span>
</header>
<main>
<div class="agenda">
<span>Agendamentos do dia:</span>
<div class="lista" >
<button class="botao" id="btnHora"   onClick="showModal(this.value), clearParticipante()" value="07:00">Horario: 07:00</button>
<button class="botao" id="btnHora1"  onClick="showModal(this.value), clearParticipante()" value="07:30">Horario: 07:30</button>
<button class="botao" id="btnHora2"  onClick="showModal(this.value), clearParticipante()" value="08:00">Horario: 08:00</button>
<button class="botao" id="btnHora3"  onClick="showModal(this.value), clearParticipante()" value="08:30">Horario: 08:30</button>
<button class="botao" id="btnHora4"  onClick="showModal(this.value), clearParticipante()" value="09:00">Horario: 09:00</button>
<button class="botao" id="btnHora5"  onClick="showModal(this.value), clearParticipante()" value="09:30">Horario: 09:30</button>
<button class="botao" id="btnHora6"  onClick="showModal(this.value), clearParticipante()" value="10:00">Horario: 10:00</button>
<button class="botao" id="btnHora7"  onClick="showModal(this.value), clearParticipante()" value="10:30">Horario: 10:30</button>
<button class="botao" id="btnHora8"  onClick="showModal(this.value), clearParticipante()" value="11:00">Horario: 11:00</button>
<button class="botao" id="btnHora9"  onClick="showModal(this.value), clearParticipante()" value="11:30">Horario: 11:30</button>
<button class="botao" id="btnHora10" onClick="showModal(this.value), clearParticipante()" value="12:00">Horario: 12:00</button>
<button class="botao" id="btnHora11" onClick="showModal(this.value), clearParticipante()" value="12:30">Horario: 12:30</button>
<button class="botao" id="btnHora12" onClick="showModal(this.value), clearParticipante()" value="13:00">Horario: 13:00</button>
<button class="botao" id="btnHora13" onClick="showModal(this.value), clearParticipante()" value="13:30">Horario: 13:30</button>
<button class="botao" id="btnHora14" onClick="showModal(this.value), clearParticipante()" value="14:00">Horario: 14:00</button>
<button class="botao" id="btnHora15" onClick="showModal(this.value), clearParticipante()" value="14:30">Horario: 14:30</button>
<button class="botao" id="btnHora16" onClick="showModal(this.value), clearParticipante()" value="15:00">Horario: 15:00</button>
<button class="botao" id="btnHora17" onClick="showModal(this.value), clearParticipante()" value="15:30">Horario: 15:30</button>
<button class="botao" id="btnHora18" onClick="showModal(this.value), clearParticipante()" value="16:00">Horario: 16:00</button>
<button class="botao" id="btnHora19" onClick="showModal(this.value), clearParticipante()" value="16:30">Horario: 16:30</button>
</div>
</div>
</main>
</section>
<section>
<iframe id="frame" src="Calendario.php?numerosala=<?php echo $numerosala ?>&dia=<?php echo $dia ?>+ &mes=<?php echo $mes ?>&ano=<?php echo $ano ?>" style="width: 100%;height: 100%;border: none;"></iframe>
</section>
</div>
</body>
<footer>

<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="Scripts/Agenda.js"></script> 
<div class="modal" id='modal'>
<div class="modal-content">
<span  class="closeModal" onclick= hideModal()  >&times;</span>
<br>
<form id="formulario_agenda" action="https://ssl9348.websiteseguro.com/ricardoalmeida/ti_desenvolvimento/Projeto-Sala-de-Reuniao/App/Model/insert.php" method="POST">
<div class="Formulario">        
<div class="CamposSolicitante">
<div class="Titulo">Nome solicitante</div>            
<div class="Caixa-Texto"><input type="text" name="nome_solicitante" id="solicitante" class="CaixaDeTexto" required="true"></div>
<div class="Titulo">E-mail solicitante</div>
<div class="Caixa-Texto"><input type="email" name="email_solicitante" id="emailsolicitante" class="CaixaDeTexto" required="true"></div>


<div class="CamposConvidados">

</div>
<span>Horário de Inicio da Reunião:</span><span class="horario-inicio"></span> <br>
<span id="horario-final">Previsão de Término da Reunião </span><input class="horario-final" type="time" name="hora_final" required>
</div>
<input type="hidden" class="horario-inicio" name="hora_comeco" value="">
<input type="hidden" id="numerosala" name="sala" value="<?php echo $numerosala ?>">
<input type="hidden" name="dia" id="diaagenda" value="<?php echo $dia ?>">
<input type="hidden" name="mes" id="mesagenda" value="<?php echo $mes ?>">
<input type="hidden" name="ano" id="anoagenda"value="<?php echo $ano ?>">
<div class="Controle-Formulario">
<button type="button" class="BtAdcParticipante" onclick="AdicionandoParticipante()">Adicionar Participante</button>
<button type="submit" form="formulario_agenda" class="BtAgendar" value="Enviar" name="enviar" onclick="clickMouse(hora), hideModal()"> Agendar</button>
</div>
</div>
</form>        
</div>
</div>
</footer>
</html>

PHP中有邮件功能,但是您也可以使用更高级的PHPMailer类来发送电子邮件。您还可以附加。ics/。这是一个文本文件,你可以用纯PHP自己生成,以现有文件为例。

提到的iCalendar网站有一个iCalendar格式验证器,你可以用它来测试你自己生成的文件。

生成日历文件时需要注意三件重要的事情-时区定义,行宽限制(75八位字节)和换行符应该是CRLF(或rn),即使你在Unix/Linux中生成它们。更多的信息。

相关内容

  • 没有找到相关文章

最新更新