curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:" \ -d '{ "bounce_address":"", "from": {"address": "noreply@"}, "to": [{"email_address": {"address": "user@domain.com","name": "John Deo"}}], "subject":"Test Email", "htmlbody":"
Test email sent successfully.
"}' #### #!/usr/bin/perl use strict; use warnings; use HTTP::Tiny; use JSON; use Data::Dumper; print "Content-type: text/html\n\n"; my $url = "https://api.zeptomail.com/v1.1/email"; my $json = encode_json { bounce_address => 'bounce@email', from => 'noreply@email.com', to => 'receipt@email.com', subject => 'Test Email', htmlbody => '
Test email sent successfully.
', }; my $http = HTTP::Tiny->new( default_headers => { Authorization => 'Token', } ); my $response = $http->post( $url => { content => $json, headers => { 'Content-Type' => 'application/json' }, }); if ( $response->{'is_success'} ) { print Dumper( decode_json $response->{'content'} ); } else { print "$response->{'content'} $response->{'reason'}\n"; } ##
## {"error":{"code":"TM_3501","details":[{"code":"GE_122","message":"Invalid value found","target":"from"}],"message":"Unprocessable Entity","request_id":"2d6f.1281848db93b53d5.m1.659b6560-d7c7-11ed-90d9-525400d4bb1c.1876c4546b6"}}