Email Audit
Code Example
Functions
FAQ
Log In
Sign Up
EmailAudit
Code Example
Functions
FAQ
Log In
Sign Up
Developer for Developer
Code Examples displayed with default tools
PHP
C#
isSMTP(); $mail->Host = 'mx1.smtp.emailsocket.com'; $mail->SMTPAuth = true; $mail->Username = 'smtpUsername'; $mail->Password = 'smtpPassword'; $mail->Port = 25; $mail->Sender = "bounce@domain.tld"; $mail->From = 'no-reply@domain.tld'; $mail->FromName = 'Company Name'; $mail->addAddress('customer@domain.tld', 'John Doe'); $mail->isHTML(true); $mail->Subject = 'Test Mail'; $mail->Body = 'This is the HTML message body
in bold!
'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } ?>
using System.Net; using System.Net.Mail; namespace adRom.SmtpRelayExample { public class MailFactory { public void SendMail() { var message = new MailMessage(); message.From = new MailAddress("no-reply@domain.tld", "Company Name"); message.To.Add("customer@domain.tld"); message.Subject = "Test Mail"; message.Body = "This is a test mail"; message.Sender = new MailAddress("bounce@domain.tld"); var credentials = new NetworkCredential("smtpUsername", "smtpPassword"); var smtpClient = new SmtpClient("mx1.smtp.emailsocket.com"); smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = credentials; smtpClient.Send(message); } } }