Giter VIP home page Giter VIP logo

Comments (12)

awdeorio avatar awdeorio commented on August 19, 2024

Here's a couple things to try.

Check your Python version. I expect Python 3.

$ python --version

Check the encoding of the template. I expect UTF-8.

$ file mailmerge_template.txt

from mailmerge.

lightmagic1 avatar lightmagic1 commented on August 19, 2024

Here's a couple things to try.

Check your Python version. I expect Python 3.

$ python --version

Check the encoding of the template. I expect UTF-8.

$ file mailmerge_template.txt
λ python --version
Python 3.7.3
λ file mailmerge_template.txt
mailmerge_template.txt: HTML document, UTF-8 Unicode text, with CRLF line terminators

anything else that i should try?

:(

from mailmerge.

awdeorio avatar awdeorio commented on August 19, 2024

Digging a little deeper, it looks like this is not related to actually sending the message. On my machine, I get the expected output at the terminal.

$ python3 --version
Python 3.7.2
$ file mailmerge_*
mailmerge_database.csv: ASCII text
mailmerge_server.conf:  ASCII text
mailmerge_template.txt: HTML document text, UTF-8 Unicode text
$ mailmerge 
>>> message 0
TO: [email protected]
SUBJECT: Testing mailmerge
FROM: My Self <[email protected]>
Content-Type: text/html; charset="utf-8"

<!doctype html>
<html lang="pt-br">

<head>
    <title> Page title </title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style type="text/css">
        * {
            margin: 0;
            border: 0;
            padding: 0;
            color: red;

            font-family: Arial, Helvetica, sans-serif;
        }
    </style>
</head>

<body>

<h1>ççç ÇÇÇ áéíóú !.</h1>
</body>

</html>

>>> encoding utf-8
>>> sent message 0 DRY RUN
>>> Limit was 1 messages.  To remove the limit, use the --no-limit option.
>>> This was a dry run.  To send messages, use the --no-dry-run option.

Next thing to check is the file encoding of the database.

from mailmerge.

lightmagic1 avatar lightmagic1 commented on August 19, 2024

mailmerge_database.csv: ASCII text, with CRLF line terminators
mailmerge_server.conf: ASCII text, with CRLF line terminators
mailmerge_template.txt: HTML document, UTF-8 Unicode text, with CRLF line terminators

from mailmerge.

awdeorio avatar awdeorio commented on August 19, 2024

That looks OK to me. Next thing to try: use the smallest email you can to try and reproduce the bug. Something like this:

mailmerge_template.txt

TO: {{email}}
SUBJECT: Testing mailmerge
FROM: My Self <[email protected]>
ççç ÇÇÇ áéíóú

from mailmerge.

lightmagic1 avatar lightmagic1 commented on August 19, 2024

TO: {{email}}
SUBJECT: Testing mailmerge
FROM: My Self [email protected]
ççç ÇÇÇ áéíóú

mailmerge_template.txt

TO: {{email}}
SUBJECT: Testing mailmerge
FROM: My Self <[email protected]>
ççç ÇÇÇ áéíóú

Output

λ mailmerge --no-dry-run
>>> message 0
TO: [email protected]
SUBJECT: Testing mailmerge
FROM: My Self <[email protected]>
ççç ÇÇÇ áéíóú
>>> encoding utf-8
>>> Read SMTP server configuration from mailmerge_server.conf
>>>   host = smtp.gmail.com
>>>   port = 465
>>>   username = [email protected]
>>>   security = SSL/TLS
>>> password for [email protected] on smtp.gmail.com:
>>> sent message 0
>>> No attachments were sent with the emails.
>>> Limit was 1 messages.  To remove the limit, use the --no-limit option.

Message in my inbox:

image

from mailmerge.

awdeorio avatar awdeorio commented on August 19, 2024

Let's try it without mailmerge, just with Python.

$ cp mailmerge_template.txt test.py

Edit test.py to look like this:

print("ççç ÇÇÇ áéíóú")

Now run it.

$ file test.py
test.py: UTF-8 Unicode text
$ python3 test.py 
ççç ÇÇÇ áéíóú

from mailmerge.

lightmagic1 avatar lightmagic1 commented on August 19, 2024
print("ççç ÇÇÇ áéíóú")
λ cp mailmerge_template.txt test.py

λ file test.py
test.py: UTF-8 Unicode text, with no line terminators

λ python3 test.py
ççç ÇÇÇ áéíóú

from mailmerge.

awdeorio avatar awdeorio commented on August 19, 2024

Well, looks like that's not it. Is mailmerge using Python2 or Python3?

$ which mailmerge 
/usr/local/bin/mailmerge
$ head /usr/local/bin/mailmerge
#!/usr/local/opt/python/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys

from mailmerge.__main__ import cli

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(cli())

from mailmerge.

lightmagic1 avatar lightmagic1 commented on August 19, 2024

Well, looks like that's not it. Is mailmerge using Python2 or Python3?

$ which mailmerge 
/usr/local/bin/mailmerge
$ head /usr/local/bin/mailmerge
#!/usr/local/opt/python/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys

from mailmerge.__main__ import cli

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(cli())

Anaconda CondaEnv Python 3.7.3

λ pip list
Package       Version
------------- --------
backports.csv 1.0.7
certifi       2019.3.9
chardet       3.0.4
Click         7.0
configparser  3.7.4
future        0.17.1
Jinja2        2.10.1
mailmerge     1.8
MarkupSafe    1.1.1
pip           19.0.3
setuptools    41.0.0
wheel         0.33.1
wincertstore  0.2
λ which mailmerge
/c/Anaconda3/envs/qrcode/Scripts/mailmerge

λ head /c/Anaconda3/envs/qrcode/Scripts/mailmerge
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

>>> #!/usr/local/opt/python/bin/python3.7
>>> # -*- coding: utf-8 -*-
>>> import re
>>> import sys
>>> from mailmerge.__main__ import cli
ççç ÇÇÇ áéíóú
>>> if __name__ == '__main__':
...      sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
...      sys.exit(cli())
...
>>> message 0
TO: [email protected]
SUBJECT: Testing mailmerge
FROM: My Self <[email protected]>
ççç ÇÇÇ áéíóú
>>> encoding utf-8
>>> sent message 0 DRY RUN
>>> No attachments were sent with the emails.
>>> Limit was 1 messages.  To remove the limit, use the --no-limit option.
>>> This was a dry run.  To send messages, use the --no-dry-run option.

That's weird o_o

from mailmerge.

awdeorio avatar awdeorio commented on August 19, 2024

Mailmerge works with either Python2 or Python3. Next thing to try: let's see if Anaconda is causing a problem. We'll install mailmerge from source, using the absolute path to a non-Anaconda python executable. If you're on Windows, use WSL or Cygwin. If you're on OSX, use homebrew to install Python.

Make sure that your Python executable is not Anaconda. Make sure that PYTHONPATH is not set.

$ which python3
/usr/local/bin/python3
$ echo $PYTHONPATH
# <blank>

Get the source code

$ git clone https://github.com/awdeorio/mailmerge.git
Cloning into 'mailmerge'...

Install using the absolute path to Python 3. Install virtual environment with a local copy of pip.

$ /usr/local/bin/python3 -m venv venv
$ source venv/bin/activate
$ which pip
/Users/awdeorio/Downloads/mailmerge/venv/bin/pip
$ pip install -e .

Verify that you have a local copy of mailmerge installed.

$ which mailmerge
/Users/awdeorio/Downloads/mailmerge/venv/bin/mailmerge
$ mailmerge --version
mailmerge, version 1.9

Now, try your test again.

from mailmerge.

awdeorio avatar awdeorio commented on August 19, 2024

Looks like this issue has gone stale. Please reopen if you have more information!

from mailmerge.

Related Issues (20)

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.