Page 1 of 1

tsNetSmtpSync

Posted: Thu Oct 25, 2018 1:23 pm
by bertBUSIbr8
Hi,


I have the tsNetSmtpSync command working in that it sends emails fine.

What I do get is that the arriving email show "undisclosed-recipients" instead of the recipients email address.

Is there a way to have the recipients email address showing?


Secondly, how can you add a subject line?


Many thanks,


Bert

Re: tsNetSmtpSync

Posted: Thu Oct 25, 2018 1:50 pm
by Klaus
Hi Bert,
bertBUSIbr8 wrote:
Thu Oct 25, 2018 1:23 pm
...What I do get is that the arriving email show "undisclosed-recipients" instead of the recipients email address.
Is there a way to have the recipients email address showing?
sorry, no idea.
bertBUSIbr8 wrote:
Thu Oct 25, 2018 1:23 pm
...Secondly, how can you add a subject line?
From the dictionary:
...
pData
The e-mail message that is to be send to the server. This should include the e-mail header followed by a blank line and then the body of the e-mail.
...
I guess "e-mail header" is in fact the subject line, at least worth a try :-)


Best

Klaus

Re: tsNetSmtpSync

Posted: Thu Oct 25, 2018 1:59 pm
by Klaus

Re: tsNetSmtpSync

Posted: Thu Oct 25, 2018 2:06 pm
by bertBUSIbr8
Hi Klaus,


Thanks for your reply. I had come across that but could make something work. However, looking back at the sample stack mentioned here:

http://lessons.livecode.com/m/4071/l/68 ... t-external

If I put something like this:

put "From: Me <me@mydomain.com>" & cr & "To: bert <recipient1@mydomain.com>" & cr & "Cc: Someone <recipient2@yourdomain.com>" & cr &"Subject: Test Message" & cr &"message body" into tPostData

That will actually wokr in that it sets the from, to, subject etc. for the email and show up ok when it arrives. So just a matter of dynamically populating it with the correct data.


Bert

Re: tsNetSmtpSync

Posted: Fri Oct 26, 2018 7:17 am
by charlesBUSd8qF
Hi All,

Sending messages via the tsNetSmtp* functions can be a bit confusing at first if you are not familiar with the SMTP protocol.

When sending e-mail via SMTP, the sender and recipients addresses are specified separately to the actual contents of the e-mail message. However, when an e-mail client displays the "From" and "To" addresses (along with the e-mail "Subject"), it uses the e-mail headers specified in the actual e-mail message that has been sent.

The e-mail headers are sent as part of the e-mail message (usually one per line) followed by a blank line and then the body of the e-mail message.

Bert's response above is a nice simple example, it sets the From:, To:, Cc: and Subject: headers that will be displayed by the e-mail client.

Charles