GithubHelp home page GithubHelp logo

commenttomail's Issues

发送邮件时报错

具体报错:syntax error, unexpected '|', expecting ';' or '{'
具体环境:php7.4、Typecho1.2

Error: Undefined constant "TypechoPlugin\CommentToMail\GLOB_BRACE" in /app/usr/plugins/CommentToMail/Console.php:49

安装,启用,配置都没有问题,但是一评论就报错。

在评论邮件提醒中看到了这个报错。

Error: Undefined constant "TypechoPlugin\CommentToMail\GLOB_BRACE" in /app/usr/plugins/CommentToMail/Console.php:49
Stack trace:
#0 /app/var/Typecho/Widget.php(155): TypechoPlugin\CommentToMail\Console->execute()
#1 /app/usr/plugins/CommentToMail/page/console.php(54): Typecho\Widget::widget('TypechoPlugin\C...')
#2 /app/admin/extending.php(14): require_once('/app/usr/plugin...')
#3 {main}

在StackOverflow中看到了解释,我用的是dockers alpine镜像导致了报错。

https://stackoverflow.com/questions/48377176/notice-use-of-undefined-constant-glob-brace

报错

如下错误是需要使用PHP8.0么,因为现在是PHP7.2。如果是PHP7.2,应该如何修改,谢谢

syntax error, unexpected 'Db' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

不支持STARTTLS

插件不支持STARTTLS协议,也就无法支持到Outlook邮箱

[bug] 'typecho.typecho_email' does not exist.

Environment

  • typecho 1.2.0
  • PHP 8.0
  • Nginx 1.20.2
  • MariaDB 10.5.15

Issue

发送邮件时提示typecho.typecho_email这张表不存在,看了一下Plugin.php中的dbInstall

CommentToMail/Plugin.php

Lines 245 to 251 in 07c5df1

$installDb = Db::get();
$type = array_pop(explode('_', $installDb->getAdapterName())); //数据库类型 mysql/sqlite/postgres
$prefix = $installDb->getPrefix(); //表前缀
$scripts = file_get_contents(__DIR__ . '/sql/' . $type . '.sql');
$scripts = str_replace('typecho_', $prefix, $scripts);
$scripts = str_replace('%charset%', 'utf8', $scripts);

发现是type字段的问题,我这里返回的type是mysqli而不是mysql

Solution

复制一份/sql下的Mysql.sql,重命名为Mysqli.sql

评论之后没有邮件

最外部的系统是Ubuntu 20.04
里面装了docker,使用的joyqi/typecho:1.2.0-php8.0-fpm-alpine镜像。

安装之后一开始报错,发现是PHP8.0的问题,然后自己手动改了代码:
之前 $files = glob($this->_template_dir . '.{html,HTML}', GLOB_BRACE);
之后 $files = glob($this->_template_dir . '
.html');

后来发现还是不能用,于是自己手动添加了postgres的一个文件内容如下:

CREATE TABLE IF NOT EXISTS typecho_mail (
id SERIAL PRIMARY KEY,
content text NOT NULL,
sent int DEFAULT 0
);

然后没有出现任何报错了,同时测试邮件可以发出去,但是评论之后没有邮件。

我用输出log的方式调试了一下,发现Plugin.php里面的函数都可以正常执行,但是Action.php中的函数没有一个得到了执行。看typecho的官方文档也没有提到Action的作用,我也不明白这个文件中的函数是怎么被调用的,所以过来求助。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.