Comment utiliser e-mailak pour envoyer ou recevoir des e-mails en php?
-
14-11-2019 - |
Question
Je voudrais utiliser Envoyez un courriel à Yak Pour envoyer et recevoir des e-mails avec PHP. Est-ce possible? Si oui, comment pourrais-je y aller?
La solution
Je ne sais pas pourquoi vous voudriez faire cela à partir de PHP, mais jetez un œil au Page manuelle 'Envoyer un e-mail' au Courriel Yak Project.
Vous devrez utiliser Extension PHPS Curl Pour faire les demandes HTTP avec les en-têtes appropriés et Native PHPS json_encode()
fonction Pour sérialiser les données que vous envoyez.
Un exemple de boucle vraiment simple de jonasjohn.de Pour vous faire avancer:
fonction curl_download ($ url) {
// is cURL installed yet? if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); } // OK cool - then let's create a new cURL resource handle $ch = curl_init(); // Now set some options (most are optional) // Set URL to download curl_setopt($ch, CURLOPT_URL, $Url); // Set a referer curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm"); // User agent curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); // Include header in result? (0 = yes, 1 = no) curl_setopt($ch, CURLOPT_HEADER, 0); // Should cURL return or print out the data? (true = return, false =
print) curl_setopt ($ ch, curlopt_returntransfer, true);
// Timeout in seconds curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Download the given URL, and return output $output = curl_exec($ch); // Close the cURL resource, and free system resources curl_close($ch); return $output;
}
Autres conseils
Email Yak utilise Get, Post et JSON. Vous pouvez certainement vous intégrer à PHP.
Voir http://docs.emailyak.com/ pour plus d'informations.