Skip to main content
Nikolaos.
Inspiring
December 7, 2020
Answered

Insert subject line in existing e-mail javascript

  • December 7, 2020
  • 1 reply
  • 676 views

Hello everyone,
I found this beautiful javascript somewhere on the net (unfortunately I can't remember exactly where),

I would like to add a subject to this script.

As a total beginner, I need the help of the specialists here.

How and where do I add a subject to the existing script without changing anything else to the script?

 

allgood();
function allgood()
{
var adr="info@datenschutz-roemer.de";
for (var i=0;i<this.numFields;i++)
{
var fName=this.getNthFieldName(i);
var f=this.getField(fName);
if (f.name == "E-Mail")
{
if(f.value != "")
{
adr=f.value;
}
}
}
if (adr=="")
{
app.alert("Keine E-Mail-Adresse angegeben!");
}
else
{
this.mailDoc({bUI: true, cTo: adr});
}
}

 

Thanks everyone in advance

Nikolaos.

This topic has been closed for replies.
Correct answer try67

Change this line:

this.mailDoc({bUI: true, cTo: adr});

To:

this.mailDoc({bUI: true, cTo: adr, cSubject: "Subject text of the email"});

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 7, 2020

Change this line:

this.mailDoc({bUI: true, cTo: adr});

To:

this.mailDoc({bUI: true, cTo: adr, cSubject: "Subject text of the email"});

Nikolaos.
Nikolaos.Author
Inspiring
December 7, 2020

It is what it is ... a dream

That happens when you have your head full ...
Didn't include the c before the subject.
I didn't see the forest for all the trees.

Many thanks

Nikolaos.