Send Mail: Define sender

Post Reply
Joerg Schober
Member
Posts: 30
Joined: Mon Mar 21, 2011 2:30 pm

Send Mail: Define sender

Post 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
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Send Mail: Define sender

Post 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
Joerg Schober
Member
Posts: 30
Joined: Mon Mar 21, 2011 2:30 pm

Send Mail: Define sender

Post 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
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Send Mail: Define sender

Post by freddyp »

I logged it as a feature request.



Freddy
Joerg Schober
Member
Posts: 30
Joined: Mon Mar 21, 2011 2:30 pm

Send Mail: Define sender

Post by Joerg Schober »

I wrote a FR last tuesday, too.
timmey
Newbie
Posts: 2
Joined: Mon Apr 09, 2018 9:19 am

Re: Send Mail: Define sender

Post 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
Zoranj
Member
Posts: 107
Joined: Tue Sep 20, 2016 7:37 pm
Location: Canada

Re: Send Mail: Define sender

Post 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/
essexmate
Member
Posts: 30
Joined: Tue Sep 05, 2017 4:41 pm

Re: Send Mail: Define sender

Post 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
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Send Mail: Define sender

Post 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.
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Send Mail: Define sender

Post by gabrielp »

Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Post Reply