Otto wrote:Hello Tim,
Yes, you are right.
Another problem is that to have the Outlook object on a PC, you need a full Outlook installation. I googled for alternatives and found suggestions to use Python or PHP. As I have never used Python before, but I think one should get used to it a little, I decided to go with PHP.
There are also many ready-made samples available.
I will do as you suggested: create an HTML file, replace the placeholders within it, and then send the HTML using PHP. In practice, it is more or less the same code as with Outlook.
However, for my purpose, it is important that the pictures arrive at the recipient's address opened.
Best regards,
Otto
Otto,
with php <?php
$message = "Line 1\r\nLine 2\r\nLine 3";
$message = wordwrap($message, 70, "\r\n");
mail(
'silvio.falconi@gmail.com', 'My Subject', $message);
?>
or with phpmailer
<form action="submit.php" method="post">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br><br>
<label for="email">Your Email:</label><br>
<input type="email" id="email" name="email" required><br><br>
<label for="subject">Subject:</label><br>
<input type="text" id="subject" name="subject" required><br><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="4" cols="50" required></textarea><br><br>
<input type="submit" value="Submit" name="send">
</form>
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["send"])) {
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username =
'RECEIVER@gmail.com';
$mail->Password = 'SECRET';
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
//Recipients
//Recipients
$mail->setFrom($email, $name);
$mail->addAddress("RECEIVER@gmail.com", );
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $_POST["subject"];
$mail->Body = "Name: $name\nEmail: $email\n\nMessage:\n$message";
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo "Send Successfully!";
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com