1 (edited by sibprogsistem 2019-03-11 23:09:19)

Topic: Mail&SerialPHP

Дмитрий, спасибо за напоминание по PHP!
 
И так в архиве два проекта,  отправка писем и регистрация на мыло через php на вашем хостинге
фал php также имеет  пароль для доступа..
что касается работы на  https то тут Вам к хозяину хостинга, по умолчанию http
 
серверная часть сделана на PHPMailer  он так же есть в архиве (папка PHP)
перед заливкай на сервер поменяйте пароль доступа в файле sendMail.php

$pol_shifr = '1230';// пороль страницы

не забудьте изменить пароль в самом проекте

function mailerphp (Host,Username,Password,SMTPSecure,Port,mailFrom,mailTo,Subject,mailMessage: string ): string;
var
    slParam: TStringList;
    pass:string;
begin
    pass:='1230';  // пороль страницы
    slParam := TStringList.Create;
    slParam.Add('pass='+pass);
    slParam.Add('Host='+Host);
    slParam.Add('Username='+Username);
    slParam.Add('Password='+Password);
    slParam.Add('SMTPSecure='+SMTPSecure);
    slParam.Add('Port='+Port);
    slParam.Add('setFrom='+mailFrom);
    slParam.Add('addAddress='+mailTo);
    slParam.Add('Subject='+Subject);
    slParam.Add('mmessage='+mailMessage);

    HTTPPost('http://Ваш_url/sendmail.php', slParam);
end;

соответственно нужно указать Ваш адрес файла sendmail.php
     
загрузку файлов реализовать не получилось, кто осилит скиньте пример..

Post's attachments

Attachment icon Mail&SerialPHP.7z 134.87 kb, 597 downloads since 2019-03-12 

Re: Mail&SerialPHP

Thank you, is there a option to add a File?

3 (edited by sibprogsistem 2019-04-01 00:41:43)

Re: Mail&SerialPHP

VascoMorais wrote:

Thank you, is there a option to add a File?

$mail ->addAttachment=($_REQUEST[sendFile]);  //Прикрепить файл 

поменяйте \ change

function mailerphp (Host,Username,Password,SMTPSecure,Port,mailFrom,mailTo,sendFile,Subject,mailMessage: string ): string;
var
    slParam: TStringList;
    pass:string;
begin
    pass:='1230';  // пороль страницы
    slParam := TStringList.Create;
    slParam.Add('pass='+pass);
    slParam.Add('Host='+Host);
    slParam.Add('Username='+Username);
    slParam.Add('Password='+Password);
    slParam.Add('SMTPSecure='+SMTPSecure);
    slParam.Add('Port='+Port);
    slParam.Add('setFrom='+mailFrom);
    slParam.Add('addAddress='+mailTo);
    slParam.Add('sendFile='+sendFile);
    slParam.Add('Subject='+Subject);
    slParam.Add('mmessage='+mailMessage);

    HTTPPost('http://Ваш_url/sendmail.php', slParam);
end;

попробуйте так \ try this

<?php
/**
 * PHPMailer simple file upload and send example
 */
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
    // First handle the upload
    // Don't trust provided filename - same goes for MIME types
    // See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation
    $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name']));
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        // Upload handled successfully
        // Now create a message
        // This should be somewhere in your include_path
        require '../PHPMailerAutoload.php';
        $mail = new PHPMailer;
        $mail->setFrom('from@example.com', 'First Last');
        $mail->addAddress('whoto@example.com', 'John Doe');
        $mail->Subject = 'PHPMailer file sender';
        $mail->msgHTML("My message body");
        // Attach the uploaded file
        $mail->addAttachment($uploadfile, 'My uploaded file');
        if (!$mail->send()) {
            $msg .= "Mailer Error: " . $mail->ErrorInfo;
        } else {
            $msg .= "Message sent!";
        }
    } else {
        $msg .= 'Failed to move file to ' . $uploadfile;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
    <form method="post" enctype="multipart/form-data">
        <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file">
        <input type="submit" value="Send File">
    </form>
<?php } else {
    echo $msg;
} ?>
</body>
</html>

Re: Mail&SerialPHP

Hello.
I have just installed apache server running PHP Module and i can confirm your example works perfectly and you just saved my project, many thanks.
But i am still having problems using your example to print reports via PDF files and sending them to email automaticly.
Could you please please please try and make an example where you print to pdf a report and use php smtp to send that file to the destinated address? Many thanks

Re: Mail&SerialPHP

Дмитрий, не подскажете случайно, чего не хватает в проекте....
файл  0 байт ... на сервер не загружает..

Re: Mail&SerialPHP

sibprogsistem wrote:

Дмитрий, не подскажете случайно, чего не хватает в проекте....
файл  0 байт ... на сервер не загружает..

К сожалению я не знаток PHP.

Dmitry.

Re: Mail&SerialPHP

Dmitry, another way to help me is make TidSMTP config avaiable for tweaking pleaseeee

Re: Mail&SerialPHP

Sibprogsistem, so... any news on how i can use phpmailer to send the export pdf files?
Sorry to bother you but i really really need this to work smile

Re: Mail&SerialPHP

VascoMorais wrote:

Sibprogsistem, so... any news on how i can use phpmailer to send the export pdf files?
Sorry to bother you but i really really need this to work smile

к сожалению не получается sad

Re: Mail&SerialPHP

sad