Knowledge Base

Home / Knowledge Base / Using UltraSMTP / Application Developers - Programming Applications to Send Mail Through UltraSMTP

 

Application developers can program their applications to send outgoing mail from their application through UltraSMTP using the following settings:

Outgoing SMTP Server NamePortSecurity
smtp.ultrasmtp.com465SSL/TLS
smtp.ultrasmtp.com25STARTTLS
smtp.ultrasmtp.com587STARTTLS
Please see sample code below for PHP and .NET.

Sample code in PHP (using PHPMailer):
require "class.phpmailer.php";
$mail = new PHPMailer;

$mail->IsSMTP();                                         	
$mail->Host = "smtp.ultrasmtp.com";	  				     	
$mail->Port = 465;
$mail->SMTPAuth = true;                                  	
$mail->Username = "yourultrasmtpusername";		         	
$mail->Password = "yourultrasmtppassword";               	
$mail->SMTPSecure = 'ssl';                               	

$mail->SetFrom("sender@senderdomain.com", "Joe Sender"); 	
$mail->AddAddress("recipient@recipientdomain.com");      	
$mail->Subject = "this is the subject line";				
$mail->Body = "this is the message body";					

if(!$mail->Send()) {
   echo 'Message could not be sent.';
   echo 'Mailer Error: ' . $mail->ErrorInfo;
   exit;
}								


Sample code in .NET (Powershell)
$recipient = "recipient@recipientdomain.com"
$sender = "sender@senderdomain.com"
$subject = "this is the subject line" 
$body = "this is the message body" 
$smtpserver = "smtp.ultrasmtp.com" 
$smtpusername = "yourultrasmtpusername";		         	
$smtppassword = "yourultrasmtppassword";		         	

$SMTPMessage = New-Object System.Net.Mail.MailMessage($sender, $recipient, $subject, $body)
$SMTPClient = New-Object Net.Mail.SmtpClient($smtpserver,  587) 
$SMTPClient.EnableSsl = $true 
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($smtpusername, $smtppassword); 
$SMTPClient.Send($SMTPMessage)					



Related:
Getting Started With UltraSMTP
Configuring Your Mail Client to Send Outgoing Mail Through UltraSMTP

© Meixler Technologies, Inc. All Rights Reserved.