This is the first time I am using the mail function. I tried to send a mail using this and the code tells me it\'s \"successfully sent\", but I didn\'t receive any mail. I\'
Disclosure: I'm one of the developers behind AlphaMail
Since you have no error to go on, it's not that easy to say what the issue is here. I would therefore recommend that to manually try and connect to the SMTP-server from your server and send the email manually. This way you'll have the error in hand instead of second-guessing.
If you don't want to do this, and just want it to "work" I would recommend that you use a Transactional Email Service such as:
Why?
If you choose to go with AlphaMail you could use the AlphaMail PHP-client.
Example:
include_once("comfirm.alphamail.client/emailservice.class.php");
$email_service = AlphaMailEmailService::create()
->setServiceUrl("http://api.amail.io/v1")
->setApiToken("YOUR-ACCOUNT-API-TOKEN-HERE");
$person = new stdClass();
$person->userId = "1234";
$person->firstName = "John";
$person->lastName = "Doe";
$person->dateOfBirth = 1975;
$response = $email_service->queue(EmailMessagePayload::create()
->setProjectId(12345) // Your AlphaMail project (determines template, options, etc)
->setSender(new EmailContact("Sender Company Name", "from@example.com"))
->setReceiver(new EmailContact("Joe Doe", "to@example.org"))
->setBodyObject($person) // Any serializable object
);
Another advantage with AlphaMail is that you can edit your templates directly in the AlphaMail Dashboard, and you can format your emails using the Comlang template language.
Name: <# payload.firstName " " payload.lastName #>
Date of Birth: <# payload.dateOfBirth #>
<# if (payload.userId != null) { #>
Sign Up Free!
<# } else { #>
Sign In
<# } #>