Variable email user name

Post Reply
DtM
Member
Posts: 27
Joined: Tue Aug 04, 2015 3:02 pm

Variable email user name

Post by DtM »

Hello all,

I've had a look around in the old threads but haven't seen anything posted recently to do with this.

We'd like to have Switch send out emails on behalf of our customer services staff, but I can't find any way of setting this dynamically.

The reply address property on Mail send does help to an existent, but it still shows the default reply address rather than the new one I've supplied.

Pressing the reply button does then send the email to the correct address, but it's unclear from the recipients perspective.

Is there any way of getting round this issue? The best case scenario would be having a variable name and email address for each email sent out.

The closest thing I found to what I need was this thread: http://forum.enfocus.com/viewtopic.php?f=13&t=354 from 3 years ago, so hopefully some progress has been made since then... :D
pcobee
Member
Posts: 21
Joined: Fri Apr 01, 2011 5:06 pm
Location: Greenville NC
Contact:

Re: Variable email user name

Post by pcobee »

If you are using Windows based Switch, you could use VBScript to create a Script element that uses CDO to send out your emails. That way you have complete control. Here's an example for sending through Office365. You'll have to adapt for Switch obviously. I've also done this using Gmail and an HMail server - just have to tweak some settings.

Code: Select all


fromEmailAddress = "myfromemail@mydomain.com"
toEmailAddresses = "tosomeone@gmail.com,tosomeoneelse@yahoo.com"
subject = "This is a test..."
mesasge = "1..2..3.."

' **** CHANGE NOTED VALUES IN SendNotification function ****

Call SendNotification(fromEmailAddress,toEmailAddresses,"","",subject,mesasge)


Sub SendNotification(fromAddress, toAddress, ccAddress, bccAddress, subject, message)
	Const cdoAnonymous = 0 'Do not authenticate
	Const cdoBasic = 1 'basic (clear-text) authentication
	Const cdoNTLM = 2 'NTLM
	Const cdoSendUsingPort = 2

	Set objMessage = CreateObject("CDO.Message") 
	objMessage.Subject = subject 
	objMessage.From = fromAddress 
	objMessage.To = toAddress 
	objMessage.TextBody = message
	If ccAddress <> "" Then objMessage.Cc = ccAddress
	If bccAddress <> "" Then objMessage.Bcc = bccAddress
	
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort	' remote server 
	
	'Name or IP of Remote SMTP Server  **** MUST CHANGE THIS VALUE TO MATCH YOUR SETUP ****
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxxxxx.outlook.com"
	
	'Type of authentication, NONE, Basic (Base64 encoded), NTLM
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic		
	
	'Your UserID on the SMTP server  **** MUST CHANGE THIS VALUE TO MATCH YOUR SETUP ****
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "validuser@mycompany.com"
	
	'Your password on the SMTP server  **** MUST CHANGE THIS VALUE TO MATCH YOUR SETUP ****
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
	
	'Server port (typically 25)
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587  
	
	'Use SSL for the connection (False or True)
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false		' False
	
	'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
	objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 15
	
	objMessage.Configuration.Fields.Update
	
	'==End remote SMTP server configuration section==
	
	objMessage.Send
	
	Set objMessage = nothing
End Sub
Post Reply