Knowledge Base

Result search in category Send-Emails-Scripts New Search
Hosting >> Business >> Send Emails Scripts
Send Email with ASPEMail component

ASPEmail component allows to send emails throu ASP and ASP.NET scripts.

A complete documentation of ASPEmail scripts is available at http://www.aspemail.com/manual.html.

Following is an example to send an email with SMTP Authentication:
<%
	Set Mail = Server.CreateObject("Persits.MailSender")
		
	Mail.Host = "mail.yourdomain.com"
		
	'SMTP AUTENTICATION
	Mail.Username = "emailaddress@yourdomain.com"		
	Mail.Password = "passwordemail"
	

	Mail.From = "emailaddress@yourdomain.com"
	Mail.FromName = "Your Name" ' optional
	Mail.AddAddress "emailaddress@recipient.com"
		
	' message subject
	Mail.Subject = "Subject"
	' message body
	Mail.Body = "Body"
		
	strErr = ""
	bSuccess = False
	On Error Resume Next ' catch errors
	Mail.Send	' send message
	If Err <> 0 Then ' error occurred
		strErr = Err.Description
	else
		bSuccess = True
	End If
%>
 
Hosting >> Business >> Send Emails Scripts
Send Email with AspSmartMail component

AspSmartMail component allows to send emails throu ASP and ASP.NET scripts.

It is possible to have examples and documentation on various search engine (eg. Google).

Following is an example to send an email with SMTP Authentication:
<%
	'Dim smtpserver,youremail,yourpassword,yourusername,remoteemail
	
	'Edit these 3 values accordingly
	smtpserver = "mail.yourdomain.com"
	youremail = "emailaddress@yourdomain.com"
	yourname = "Your Name"
	yourusername = "emailaddress@yourdomain.com"
	yourpassword = "yourpassword"
	remoteemail = "emailaddress@yourdomain.com"
	
	strBody= "Body Message"
	
	Dim ObjSendMail
	Set ObjSendMail = Server.CreateObject("AspSmartMail.SmartMail")
	
	'Config remote SMTP server info.
	
	ObjSendMail.Server = smtpserver
	ObjSendMail.ServerTimeOut = 35
	ObjSendMail.SenderAddress = youremail
	ObjSendMail.Username = yourusername
	ObjSendMail.Password = yourpassword
	
	'End remote SMTP server config.
	
	'Config E-mail.
	ObjSendMail.Recipients.Add remoteemail 
	'ObjSendMail.CCs.Add "cc_email@domain.com"
	ObjSendMail.Subject = "Email Subject"
	ObjSendMail.SenderName = yourname
	
	ObjSendMail.ContentType = "text/html"
	ObjSendMail.Body = strBody
	'End Config E-mail.
	
	'ObjSendMail.Send
	ObjSendMail.SendMail
	
	if err.number <> 0 then
	
	response.write("Error n° " & err.number - vbobjecterror & " = " & err.description & "
") else Response.Write "aspSmartMail has sent your message with this file as attachment :
" 'Response.Write ObjSendMail.Attachments.Item(1).FilePathName end if Set ObjSendMail = Nothing %>
 
Hosting >> Business >> Send Emails Scripts
Send Email with CDOSYS component

CSOSYS component allows to send emails throu ASP and ASP.NET scripts.

CDOSYS component is the unique pre-installed component on Windows Server 2003 and 2008.

Following is an example to send an email with SMTP Authentication:
<%
	Dim ObjSendMail
	Set ObjSendMail = CreateObject("CDO.Message") 
		 
	'This section provides the configuration information for the remote SMTP server.
		 
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yourdomain.com"
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
		 
	' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
	'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
	'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="youraddress@yourdomain.com"
	'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword"
		 
	ObjSendMail.Configuration.Fields.Update
		 
	'End remote SMTP server configuration section==
		 
	ObjSendMail.To = "email@recipient.com"
	ObjSendMail.Subject = "this is the subject"
	ObjSendMail.From = "youraddress@yourdomain.com"
		 
	' we are sending a text email.. simply switch the comments around to send an html email instead
	'ObjSendMail.HTMLBody = "this is the body"
	ObjSendMail.TextBody = "this is the body"
		 
	ObjSendMail.Send
		 
	Set ObjSendMail = Nothing 
%>
 
Hosting >> Business >> Send Emails Scripts
Send Email with PHP MAILER component

PHP MAILER component allows to send emails throu PHP.

Install PHP MAILER is simple and requires a few steps. Once the files are downloaded from the website http://phpmailer.sourceforge.net/ you must copy the classes and class.phpmailer.php class.smtp.php in your space, and include them in the script that will use.

Following is an example to send an email with SMTP Authentication:
<?
	include("class.phpmailer.php");
	
	$sender = "address@yourdomain.com";
	$sendername = "Your name";
	$receiver = "address@receiver_domain.com";
	
	$ServerSMTP = "mail.yourdomain.com";  //SMTP AUTHENTICATION
	
	$message_body = "Your message";
	
	$message = new PHPMailer;

	// use SMTP instead of mail() php command
	$message->IsSMTP(); 
	$message->SMTPAuth   = true;
	$message->SMTPKeepAlive = "true";
	$message->Host  = $ServerSMTP;
	$message->Username   = "address@yourdomain.com";      // user SMTP server authentication
	$message->Password   = "emailpassword";    // password SMTP server authentication
	
	$message->From   = $sender;
	$message->FromName = $sendername;
	$message->AddAddress($receiver); 
	$message->Body = $message_body;
	if(!$message->Send()) {
		echo "error: ".$message->ErrorInfo;
	} else {
		echo "message sent";
	}  
?>
 
New Search
This website uses cookies. Some of these cookies have been set already. More information can be read in our privacy policy.
You can accept our cookies by clicking here or by continuing to use the site