LoginSignup
1
0

More than 5 years have passed since last update.

Django で Gmail を送信する (その2)

Posted at

こちらのプログラムを改造して、宛先、タイトル、本文をページから変更できるようにしました。
Django で Gmail を送信する

送信画面
gmail_dec3001.png

コードは GitHub にあります。
ekzemplaro/django_gmail_send

デプロイの手順

1) ライブラリーのインストール

sudo pip install django-environ

2) GitHub からクローン

git clone https://github.com/ekzemplaro/django_gmail_send

3) proj01 (manage.py のあるフォルダー) に .env を作成

proj01/.env
userId="aaabbb@gmail.com"

4) gmail_send/lib/credentials.json を置く

5) gmail_send/lib/test_gmail.py の
  mail_to を編集

6) .credentials の取得

ln -s ../../.env .
./test_gmail.py --noauth_local_webserver

スクリプトの指示に従って、コードを入れて下さい。

取得できたら、次のようにして、メールが送信できることを確認

./test_gmail.py

7) 開発サーバーを起動

python manage.py runserver

8) ブラウザーで http://127.0.0.1:8000/gmail_send/ にアクセス

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0