Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6f7497
commit 2ecdd3d
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ chroot/ | |
*.md5 | ||
image/casper/filesystem.squash* | ||
image/casper/vm* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/env python3 | ||
import http.client | ||
import os | ||
import datetime | ||
import base64 | ||
|
||
#attachment encoding | ||
with open('../log.txt','rb') as f: | ||
data = f.read() | ||
f.close() | ||
|
||
attachment = base64.b64encode(data) | ||
|
||
conn = http.client.HTTPSConnection("api.sendgrid.com") | ||
|
||
print (os.environ["email"]) | ||
payload = "{\"personalizations\":[{\"to\":[{\"email\":\"" + os.environ["email"] + "\"}],\"subject\":\"Your ISO is Ready\"}],\"from\":{\"email\":\"xeon.harsh@gmail.com\",\"name\":\"Meilix Generator\"},\"reply_to\":{\"email\":\"xeon.harsh@gmail.com\",\"name\":\"Meilix Generator\"},\"subject\":\"Your ISO is ready\",\"content\":[{\"type\":\"text/html\",\"value\":\"<html><p>Hi,<br>Your Build Gave error please report it to the developer<br><br>Thank You,<br>Meilix Generator Team</p></html>\"}],\"attachments\":[{\"content\":\""+str(attachment)[2:-1]+"\",\"type\":\"text/plain\",\"filename\":\"log.txt\"}]}" | ||
|
||
print (type(payload)) | ||
|
||
authorization = "Bearer " + os.environ["mail_api_key"] | ||
|
||
headers = { | ||
'authorization': authorization, | ||
'content-type': "application/json" | ||
} | ||
|
||
conn.request("POST", "/v3/mail/send", payload, headers) | ||
|
||
res = conn.getresponse() | ||
data = res.read() | ||
|
||
print(data.decode("utf-8")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#! /usr/bin/env python3 | ||
import http.client | ||
import os | ||
import datetime | ||
import base64 | ||
|
||
#attachment encoding | ||
with open('../log.txt','rb') as f: | ||
data = f.read() | ||
f.close() | ||
|
||
attachment = base64.b64encode(data) | ||
|
||
conn = http.client.HTTPSConnection("api.sendgrid.com") | ||
|
||
date = datetime.datetime.now().strftime('%Y%m%d') | ||
url = "https://github.com/fossasia/meilix/releases/download/"+os.environ["TRAVIS_TAG"]+"/meilix-i386-custom.iso" | ||
|
||
print (os.environ["email"]) | ||
payload = "{\"personalizations\":[{\"to\":[{\"email\":\"" + os.environ["email"] + "\"}],\"subject\":\"Your ISO is Ready\"}],\"from\":{\"email\":\"xeon.harsh@gmail.com\",\"name\":\"Meilix Generator\"},\"reply_to\":{\"email\":\"xeon.harsh@gmail.com\",\"name\":\"Meilix Generator\"},\"subject\":\"Your ISO is ready\",\"content\":[{\"type\":\"text/html\",\"value\":\"<html><p>Hi,<br>Your ISO is ready<br>URL : "+url+"<br><br>Thank You,<br>Meilix Generator Team</p></html>\"}],\"attachments\":[{\"content\":\""+str(attachment)[2:-1]+"\",\"type\":\"text/plain\",\"filename\":\"log.txt\"}]}" | ||
|
||
print (type(payload)) | ||
|
||
authorization = "Bearer " + os.environ["mail_api_key"] | ||
|
||
headers = { | ||
'authorization': authorization, | ||
'content-type': "application/json" | ||
} | ||
|
||
conn.request("POST", "/v3/mail/send", payload, headers) | ||
|
||
res = conn.getresponse() | ||
data = res.read() | ||
|
||
print(data.decode("utf-8")) |