nuǝW pǝuoᴉʇᴉsoԀ ʎlǝʌᴉʇɐƃǝN

    react-native-sendgrid

    1.0.2 • Public • Published

    If this project result useful for you consider donate

    ko-fi

    React Native SendGrid

    Is a API Wrapper for SendGrid, Usage is simple

    Installation

    npm install --save react-native-sendgrid

    Usage

    import { sendGridEmail } from 'react-native-sendgrid'
    ...
    ...
    const SENDGRIDAPIKEY = "YOURAPIKEY";
    const FROMEMAIL = "test@test.com";
    const TOMEMAIL = "me@test.com";
    const SUBJECT = "You have a new message";
    
    export class ContactForm extends Component {
    	constructor(props) {
       		super(props);
       		this.state = {name : "", email: "", phone:""};
    	}
    
    	yourSendEmailFunction(){
    		
    		const ContactDetails = "Contact Data: " + this.state.name + " Mail: "+ this.state.email+" Phone: "+this.state.phone
    		
    		const sendRequest = sendGridEmail(SENDGRIDAPIKEY, TOMEMAIL, FROMEMAIL, SUBJECT, ContactDetails )
    	        sendRequest.then((response) => {
    	            console.log("Success")
    	        }).catch((error) =>{
    	            console.log(error)
    	        });
    	}
    
    }

    Use HTML

    By default all emails are send in "text/plain" format if you want to use html format just use this way:

    const sendRequest = sendGridEmail(SENDGRIDAPIKEY, TOMEMAIL, FROMEMAIL, SUBJECT, ContactDetails, "text/html" )

    admin@scriptmatico.com

    Install

    npm i react-native-sendgrid

    DownloadsWeekly Downloads

    29

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    3.4 kB

    Total Files

    3

    Last publish

    Collaborators

    • avatar