Page 1 of 1

Send Mail: Define sender

Posted: Tue Jul 23, 2013 2:17 pm
by Joerg Schober
The send mail-element does not allow to define the sender of the mail, this adress is defined in the switch preferences. We have the requirement to send from various email-adresses. Is a script or a similar solution available for this?



Kind regards,

Jörg

Send Mail: Define sender

Posted: Wed Jul 24, 2013 4:02 pm
by freddyp
That is what you define in the property "Reply address". If that is empty, the address in the Preferences is being used.



Freddy

Send Mail: Define sender

Posted: Wed Jul 24, 2013 4:43 pm
by Joerg Schober
Hi Freddy,

I'm aware of this and i already use it.

The main reason for the demand are out-of-office-mails: We send out > 100 mails per day and in the holiday season we get many out-of-office notifications. The most are replied to the sender and not to the reply-to adress.



Kind regards,

Jörg

Send Mail: Define sender

Posted: Wed Jul 24, 2013 5:23 pm
by freddyp
I logged it as a feature request.



Freddy

Send Mail: Define sender

Posted: Thu Jul 25, 2013 8:56 am
by Joerg Schober
I wrote a FR last tuesday, too.

Re: Send Mail: Define sender

Posted: Wed Aug 22, 2018 11:34 am
by timmey
Anything new on this? We have the same requirement. Is it possible right now?
And we also need to change the name of the sender based on the processed job.

Thanks!

Tim

Re: Send Mail: Define sender

Posted: Wed Aug 22, 2018 5:49 pm
by Zoranj
They probably do not want to put this feature in Switch due to probable spam use.
For this particular reason, I am using little windows free app called Blat, http://www.blat.net/

Re: Send Mail: Define sender

Posted: Thu Aug 23, 2018 12:04 am
by essexmate
I got around this by creating a VBScript in SwitchScripter which runs whenever a job arrives at the script.
Here is the example code to make the script. You can add your own From, To, Cc, and Bcc addresses.
It's not ideal but it does the job of being able to fake the sender's email address from Switch flows. I agree that it would be nice to be able to define the sender address on a flow by flow level.

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 = "Write your subject here, it is followed by the current date " & dateSubject
objMessage.From = "from_address@yourcompany.com"
objMessage.To = "to_address@theircompany.com" 
objMessage.Cc = "cc_address@anothercompany.com"
objMessage.Bcc = "bcc_address1@yourcompany.com; bcc_address2@yourcompany.com"

emailBody = "Hello World" & vbCrLf & vbCrLf _
& "You can type your message body text here" & vbCrLf & vbCrLf _
& "Kind Regards" & vbCrLf & vbCrLf _
& "on behalf of the Switch Server" & vbCrLf & vbCrLf
objMessage.TextBody = emailBody

objMessage.AddAttachment "\\yourServer\Path\Folder\AnotherFolder\EmailAttachment.zip"

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

Subject: Write your subject here, it is followed by the current date 22.08.2018
From: from_address@yourcompany.com
To: to_address@theircompany.com
Cc: cc_address@anothercompany.com
Bcc: bcc_address1@yourcompany.com; bcc_address2@yourcompany.com
Message attachment: EmailAttachment.zip

Hello World

You can type your message body text here

Kind Regards

on behalf of the Switch Server

Re: Send Mail: Define sender

Posted: Tue Aug 28, 2018 10:48 am
by JimmyHartington
I use the webservice https://postmarkapp.com for sending emails as some of my customers.

You need to setup DNS records for this to work.

And of course script to communication with the api.

I have bought a script package through my reseller (InProduction), which does this for me.

Re: Send Mail: Define sender

Posted: Thu Aug 30, 2018 7:44 pm
by gabrielp