Giter Site home page Giter Site logo

dylanroman03 / easy_resend Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8 KB

A Dart package for easy integration with the Easy Resend API to send emails with attachments.

Home Page: https://pub.dev/packages/easy_resend

License: MIT License

Dart 100.00%
api dart dart-package resend resend-email resendapi

easy_resend's Introduction

Easy Resend

A Dart package for easy integration with the Easy Resend API to send emails with attachments.

Installation

Add the following dependency to your pubspec.yaml:

dependencies:
  easy_resend: ^1.0.2

Usage

import 'package:easy_resend/easy_resend.dart';
import 'package:easy_resend/src/models/attachment.dart';

void main() async {
  // Initialize EasyResend with your API key
  EasyResend.initialize('your_api_key_here');

  // Create an instance of EasyResend
  final easyResend = EasyResend.getInstance();

  // Prepare email data
  final from = '[email protected]';
  final to = ['[email protected]', '[email protected]'];
  final subject = 'Test Email';
  final text = 'This is a test email sent using Easy Resend.';
  final attachments = [
    Attachment(filename: 'invoice.pdf', content: Uint8List.fromList([])),
    Attachment(filename: 'image.jpg', content: Uint8List.fromList([])),
  ];

  try {
    // Send the email
    final id = await easyResend.sendEmail(
      from: from,
      to: to,
      subject: subject,
      text: text,
      attachments: attachments,
    );

    print('Email sent successfully! ID: $id');
  } catch (e) {
    print('Failed to send email: $e');
  }
}

Replace 'your_api_key_here' with your actual API key. You can also customize the email data according to your requirements.

Features

  • Send emails with attachments using the Easy Resend API.
  • Handle error responses gracefully.

License

This project is licensed under the MIT License - see the LICENSE file for details.

easy_resend's People

Contributors

dylanroman03 avatar

Watchers

 avatar

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.