Test with Google Script to send mail. This works and seems to be the

only way without going through registration process with Google.
This commit is contained in:
2017-02-04 01:26:18 +01:00
parent a756549343
commit ba7520caad
2 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,47 @@
<?php
namespace Frs\Output\Transport;
class GScriptTransport implements TransportInterface
{
private $content;
private $subject;
private $headers = array();
public function __construct()
{
$this->post_url = 'https://script.google.com/macros/s/AKfycbxVcugiTBTvWx8DK_HhuQh_vXdteir6GTXE_Anir3rfovatjQM/exec';
}
public function setParam($key, $value)
{
switch ($key) {
case 'to':
// ignored
break;
case 'subject':
$this->subject = $value;
break;
case 'headers':
$this->headers = $value;
break;
}
}
public function setContent($content)
{
$this->content = $content;
}
public function transmit()
{
echo '<html><body><form method="post" action="' . $this->post_url . '">';
echo '<input type="text" name="subject" value="' . $this->subject . '"/>';
echo '<textarea name="body">' . $this->content . '</textarea>';
echo '<input type="submit" value="Send"/>';
echo '</form></body></html>';
return true;
}
}