Page 1 of 1

Sending Emails: Define Sender

Posted: Fri Jan 20, 2017 10:16 am
by abonsey
Hi All,
Please see viewtopic.php?f=13&t=354
I have the same requirement to be able to change the default email sender depending on the flow that is running. At the moment it's only showing the default from the Mail preferences within Switch.

It looked like it was going to be a feature request. Has it been added and I'm just missing how it's done.

Thanks

Andrew

Re: Sending Emails: Define Sender

Posted: Fri Jan 20, 2017 3:05 pm
by JimmyHartington
Hi Andrew

This feature could be nice.

I have implemented the service Postmark (https://postmarkapp.com) as a transactional email-sender in some of my flows.

This allows me to change the sender. Also to some of my customers emails.
But it requires some setting up in regards to DNS on the sender domain.

Re: Sending Emails: Define Sender

Posted: Fri Jan 20, 2017 4:27 pm
by gabrielp
I think you can also do this with the SES Send script in switch-aws: https://github.com/open-automation/switch-aws

Re: Sending Emails: Define Sender

Posted: Thu Aug 31, 2017 3:26 pm
by Iveon.Matthews
Hi Dominick

With the SES Send you have built for the Switch-aws Open automation project does it require an AWS account or do I just install the AWS CLI to use SES Send?

Thanks
Iveon

Re: Sending Emails: Define Sender

Posted: Thu Aug 31, 2017 3:29 pm
by gabrielp
AWS CLI requires an AWS account to use. You should install AWS CLI and then run

Code: Select all

aws configure
to link your AWS account.

Re: Sending Emails: Define Sender

Posted: Tue Sep 05, 2017 4:55 pm
by essexmate
Hi, I'm currently using a VBScript to create an email which defines a sender and attaches a file. Here is the code which you can paste into SwitchScripter. When a job arrives at the script in Switch, the email is sent and the job is moved to the next flow element.

Feel free to use it, change the From, To and Cc, body text and add an attachment if required.

Code: Select all

' Is invoked each time a new job arrives in one of the input folders for the flow element.
' The newly arrived job is passed as the second parameter.
 Function jobArrived(s, job)

Set objMessage = CreateObject("CDO.Message")

Dim fso

Set fso = CreateObject("Scripting.FileSystemObject")

'date
d = Day(date())
m = Month(date())
y = Year(date())

If len(d) = 1 Then d = "0" & d
If len(m) = 1 Then m = "0" & m

dateSubject = d & "." & m & "." & y
dateNormal = d & "-" & m & "-" & y
dateReverse = y & "-" & m & "-" & d

'email

objMessage.Subject = "Your subject goes here"
     
objMessage.From = "From@example.com"
objMessage.To = "To@example.com"
objMessage.Cc = "Cc@example.com; Cc2@example.com"
'If bccAddress <> "" Then objMessage.Bcc = bccAddress

emailBody = "Hello" & vbCrLf & vbCrLf _
& "This is your email body." & vbCrLf & vbCrLf _
& "And another line of email body goes here." & vbCrLf & vbCrLf _
& "Kind Regards" & vbCrLf & vbCrLf _
& "Signature line" & vbCrLf & vbCrLf
objMessage.TextBody = emailBody


objMessage.AddAttachment "\\servername\directory\"&dateReverse&"\"&dateReverse&"_example_attachment.pdf"

objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTPConnectString"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1      
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25  
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 15

objMessage.Configuration.Fields.Update

objMessage.Send
Set objMessage = nothing

 'Send job to next flow element
   job.sendToSingle(job.getPath())

 End Function