Giter Site home page Giter Site logo

Comments (6)

cariaso avatar cariaso commented on May 22, 2024 2

Perhaps of interest
https://github.com/mewa/s3abird

from 0x4447_product_s3_email.

davidgatti avatar davidgatti commented on May 22, 2024

O wow, a long time has passed. I won't have time to update the CFN to support the latest language, maybe some day but not now. And regarding access, check this section: https://github.com/0x4447/0x4447_product_s3_email#manual-work there is some manual work that you have to do to make it work.

from 0x4447_product_s3_email.

hyoretsu avatar hyoretsu commented on May 22, 2024

Oh, didn't notice this repo was dead for 2 years before the last commit... Seemed like it was the solution to create custom emails without paying heftier prices over at Gmail.

from 0x4447_product_s3_email.

Jefdem1 avatar Jefdem1 commented on May 22, 2024

After messing with this for a bit i realized it was pretty straight forward to setup aws simple email service. Was just a couple clicks to setup the identity and dns and then set a default rule that forwards everything to an S3 bucket. I wrote a simple boto3 python script to send mail but havent tested it yet. Was waiting for my limit approval which has now come through so maybe will test it soon. I'll post it once ive tested it.

from 0x4447_product_s3_email.

hyoretsu avatar hyoretsu commented on May 22, 2024

Yes I also managed that, but the problem comes after that. Viewing your emails from That S3 bucket

from 0x4447_product_s3_email.

Jefdem1 avatar Jefdem1 commented on May 22, 2024

So i have built and tested a solution for that. I have a javascript front end that hits an API gateway endpoint. The Api Gateway has a lambda proxy that triggers a lambda function to read the bucket. I need a better email formatter but its functional.

Lambda (Python)

import json
import boto3
s3 = boto3.client('s3')

def lambda_handler(event, context):
    get_last_modified = lambda obj: int(obj['LastModified'].strftime('%s'))
    Bucket = '<bucketname>'
    objs = s3.list_objects_v2(Bucket=Bucket)['Contents']
    emailid = int(event['queryStringParameters']['emailid'])
    last_added = [obj['Key'] for obj in sorted(objs, key=get_last_modified, reverse=True)][emailid]
    print(last_added)

    data = s3.get_object(Bucket=Bucket, Key=last_added)
    contents = data['Body'].read()


    return { 'statusCode': 200,  'body': json.dumps(contents.decode("utf-8")), 'headers': {'Content-Type': 'application/json','Access-Control-Allow-Origin': '*','Access-Control-Allow-Methods':'*'}}

Javascript website (S3 static hosted website)

<html>
<head>
<title>
</title>
</head>
  <script>
    function GetEmail()
    {
      let url = "<api gateway url>?emailid=0"
      var request = new XMLHttpRequest()
      request.open('GET', url, true)
      request.onload = function()
      {
          var data = this.response
                                                                                                  
         if(request.status >= 200 && request.status < 400)
         {
           document.getElementById('EmailTxtArea').innerHTML = data
         }
         else
         {
           console.log("error")
         }
                                                                                                 
     }
      
      request.send()
      
    }

  </script>
<body>

  <input type="button" onclick=GetEmail() value="Get Email">
<br>
  <div id=email></div>
  <br>
  <input type=text id=Email style='width: 800px; visibility: hidden;'>
  <br>
  <textarea id="EmailTxtArea" rows="4" cols="50">
</textarea>
</body>
</html>

from 0x4447_product_s3_email.

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.