PHPackages                             techamica/smtpserver-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. techamica/smtpserver-api

ActiveLibrary[API Development](/categories/api)

techamica/smtpserver-api
========================

API vendor in PHP for https://smtpserver.com

1.0.4(4y ago)11.3k—0%1MITPHP

Since Dec 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/techamica/smtpserver-api)[ Packagist](https://packagist.org/packages/techamica/smtpserver-api)[ RSS](/packages/techamica-smtpserver-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

[![Logo](https://camo.githubusercontent.com/2a2482175028454ba5fc207943f58ddb5bc1f902df518cf106e81114124d8743/68747470733a2f2f736d74707365727665722e636f6d2f646f63756d656e746174696f6e2f696d672f6c6f676f2e706e67)](https://camo.githubusercontent.com/2a2482175028454ba5fc207943f58ddb5bc1f902df518cf106e81114124d8743/68747470733a2f2f736d74707365727665722e636f6d2f646f63756d656e746174696f6e2f696d672f6c6f676f2e706e67)

smtpserver-api
==============

[](#smtpserver-api)

API vendor in PHP for . Mail sending is now super easy!

License
-------

[](#license)

[PHP License 3.0](https://www.php.net/license/3_0.txt)

[![PHP_logo](https://camo.githubusercontent.com/f1153700b0dccfc0ee24d5bfe1cc98f0f0beb249308fbad126e387be49e8864e/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f322f32372f5048502d6c6f676f2e7376672f3132303070782d5048502d6c6f676f2e7376672e706e67)](https://camo.githubusercontent.com/f1153700b0dccfc0ee24d5bfe1cc98f0f0beb249308fbad126e387be49e8864e/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f322f32372f5048502d6c6f676f2e7376672f3132303070782d5048502d6c6f676f2e7376672e706e67)

Appendix
--------

[](#appendix)

- [Installation](#installation)
- [Documentation](#documentation)
- [Screenshots](#screenshots)
- [Used By](#used-by)

Installation
------------

[](#installation)

Install `techamica/smtpserver-api` with `composer`. This package is installable only with `composer version 2x` or higher.

```
  composer update
  composer require techamica/smtpserver-api
```

Documentation
-------------

[](#documentation)

After installing `techamica/smtpserver-api` with `composer` open your `Controller script` (for `Laravel`) and use `Smtp\SmtpApiMailer` class just under your script `namespace`.

```
  use Smtp\SmtpApiMailer;
```

If you're using `Core PHP` then you need to include the `autoload.php` file into your script from the `vendor` directory. Next, use the `Smtp\SmtpApiMailer` class.

```
  require_once getcwd()."/vendor/autoload.php";

  use Smtp\SmtpApiMailer;
```

Next, create an object of `SmtpApiMailer` class. This will require you 96-character `API KEY`.

```
  $smtp = new SmtpApiMailer('YOUR_API_KEY');
```

Now set `To` mail. You can pass only one `String`(email), or an `Array` of `Strings`(emails) in order to send mail to multiple recipients at once.

```
  $smtp->setTo('test1@test.com')
        ->setTo([
          'test2@test.com',
          'test3@test.com'
        ]);
```

But, if you want to add recipients' names, you must pass an `Array` of `email ids` and `names`. Some of the `names` can be empty `String`, if you want.

```
  $smtp->setTo([
    'test3@test.com' => 'Good Recipient 1',
    'test4@test.com' => 'Good Recipient 2',
    'test5@test.com'
  ]);
```

`To` mail is mandatory in order to send mail.

Next, set `From` mail. Simply pass `from mail id` and `name` into the method. `name` is `optional`.

```
  $smtp->setFrom('info@test.com', 'Good Sender');
```

`From` mail is mandatory in order to send mail.

Next, set `Subject` of the mail. This is an `optional` step.

```
  $smtp->setSubject('Test subject for a test mail');
```

Next, set `Custom Headers`. This is also an `optional` step.

```
  $smtp->setHeader([
    'Custom-Header-1' => '',
    'Custom-Header-2' => '',
    'Custom-Header-3' => 'ABCD-17G5-098H-F5TS-0865'
  ]);
```

Set `Attachments`, if there's any. You can attach just one file by passing its path as a `String` or you can pass multiple file paths in an `Array`. But remember to put `absolute path` to the files and the total size of attachments should not exceed `25MB`. This is an `optional`step.

```
  $smtp->addFile('ABSOLUTE_PATH_TO/web.zip')
        ->addFile([
          "ABSOLUTE_PATH_TO/photo_2019-02-08_00-01-11.jpg",
          "ABSOLUTE_PATH_TO/mongodb_ the definitive guide - kristina chodorow_1401.pdf"
        ]);
```

Set `timeout` for mail sending. Default timeout is `20sec`. Depending on the attachment size &amp; internet connection this can be set to some other value. To set a new timeout, pass the value in `seconds`.

```
  $smtp->setTimeout(30);
```

Set `HTML` &amp; `Text`. Either of these two is `mandatory`. It's a good practice to put both.

```
  $smtp->->setText('This is a test mail only');
  $smtp->setHtml('This is a test mail only');
```

Finally, send mail. This method either `returns` an `Array` or `throws Error` for any setup-related issue. So make sure to use a `try-catch` block enclosing this method.

```
  try {
    $response = $smtp->sendMail();
    print_r($response);
  } catch(\Exception $e) {
    -- YOUR CODE --
  }
```

Output `Array` consists of three keys: `code`, `header` &amp; `body`. `code` is response code, `header` is response header-list &amp; `body` consists of response-body in `JSON` format. `body` looks like:

```
  { success: 1, message: 'Mail accepted' }
```

If there's error while sending mail, the `body` looks like:

```
  { success: 0, message: 'SOME ERROR MESSAGE' }
```

Screenshots
-----------

[](#screenshots)

[![CompleteCode Screenshot](https://camo.githubusercontent.com/a7c24a7bbffe46301c02f8d3d4811884bdf56eacc7f6326096f9607f09a25e83/68747470733a2f2f736d74707365727665722e636f6d2f646f63756d656e746174696f6e2f696d672f7068702d636f6d706c6574652d312e706e67)](https://camo.githubusercontent.com/a7c24a7bbffe46301c02f8d3d4811884bdf56eacc7f6326096f9607f09a25e83/68747470733a2f2f736d74707365727665722e636f6d2f646f63756d656e746174696f6e2f696d672f7068702d636f6d706c6574652d312e706e67)

Used By
-------

[](#used-by)

This project is used by the following company:

- [SMTP SERVER](https://smtpserver.com/)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

1607d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/96569009?v=4)[techamica](/maintainers/techamica)[@techamica](https://github.com/techamica)

---

Top Contributors

[![techamica](https://avatars.githubusercontent.com/u/96569009?v=4)](https://github.com/techamica "techamica (1 commits)")

### Embed Badge

![Health badge](/badges/techamica-smtpserver-api/health.svg)

```
[![Health](https://phpackages.com/badges/techamica-smtpserver-api/health.svg)](https://phpackages.com/packages/techamica-smtpserver-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
