Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using Synapse to send emails

Posted on 2006-07-05
10
Medium Priority
?
2,012 Views
Last Modified: 2012-05-05
Hi,

I'm trying Synapse to send emails with attachments and I use a function like this :

=========
var part: TMimePart;
   MM : TMimeMess;
   data:tstringlist;
   tmp: TMemoryStream;
=========
 data:=TStringList.Create;
 data.Add('This is a text');
 mm:=TMIMEMess.Create;
 mm.header.from:='me@email.com';
 mm.header.ToList.add('me@email.com');
 mm.header.subject:='A test';
 Part := mm.AddPartMultipart('Mixed', nil);
 mm.AddPartText(data, Part);
 tmp := TMemoryStream.Create;
 try
   tmp.LoadFromFile('C:\attachment.zip');
   mm.AddPartBinary(tmp, 'attachment.zip',part);
 finally
   tmp.Free;
 end;
 mm.EncodeMessage;
 SendToEx('me@email.com','me@email.com', 'Hey','smtp.email.com', MM.Lines, '','');
 MM.Free;
=========

The email is received, but looks like below:
=========
From: me@email.com
To: me@email.com
Subject: A test
Date: Wed, 5 Jul 2006 19:48:40 +0300
MIME-Version: 1.0 (produced by Synapse)
X-mailer: Synapse - Pascal TCP/IP library by Lukas Gebauer
Content-type: Multipart/Mixed; boundary="00538921_2DA5ADB8_Synapse_boundary"
Content-Description: Multipart message

--00538921_2DA5ADB8_Synapse_boundary
Content-type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline
Content-Description: Message text

This is a text
--00538921_2DA5ADB8_Synapse_boundary
Content-type: application/ZIP; name="attachment.zip"
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; FileName="attachment.zip"
Content-Description: Attached file: attachment.zip

UEsDBBQAAAAIAIVVNDOt25sN/BoAAMJzAAAHAAAAZmFxLmh0be1dbVfbSJb+PJzT/6HacybY
GyMMTaZ3DCZLwKSZQKDB3Znes+fkyFbZ1iBLGkmGONn8933urRdJfsF2ArNfIN1gW6V7b926
73VLPhhmo+BwY+NgKF3vcOMgzSaBFJ0/rtqtSiY/Zdu9NK0cio0/dY7enLedfuCmQ/FF9KIg
SppiIoMgut8X/SBys6ZI/MEww7sozLb67sgPJk1xlPhuoD+7lxiAcd0o8PYFgd9yA38QNkVP
hplM9LDU/yybYmd3X9z5qd/1Az8DIH4N2r5uCCE6J04YJSM3yGn583GD/k2hz9xhNHKnAM8l
... ... ...
--00538921_2DA5ADB8_Synapse_boundary--
=========

Please tell me what is wrong or show me a working sample.

Thanks.
0
Comment
Question by:winexec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 11

Expert Comment

by:calinutz
ID: 17048960
Why don't you try indy? It's simpler to use. These components do not seem to be able to send attachements other way than inline ones.

0
 
LVL 1

Author Comment

by:winexec
ID: 17050778
I want to keep my app as small as possible (no forms etc.).
I've heard good things about Synapse, are you sure isn't working with attachments?
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17051277
Seems your email CLIENT is the culprit here as it *should* handle the MultiPart/Mixed file
just fine.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 26

Expert Comment

by:EddieShipman
ID: 17051280
If that is what is showing in your email client, that is.
0
 
LVL 1

Author Comment

by:winexec
ID: 17051374
Thanks Eddie, but I don't think it's my email client fault. I've tried webmails like Yahoo and Safe-mail.net, it happened the same thing :(
0
 
LVL 11

Expert Comment

by:calinutz
ID: 17053567
It is not the email client.... The same result is shown with Outlook Express and directly in the webpage of the email server. It is just that it attaches the "attachement" in-line, that's what happens. Instead of attaching the file, it encrypts it and inserts the encryptet text intto the body.
  I read the source of the synapse and I did not see anything related to attaching files. I guess they stopped before solving this matter.

Regards
0
 
LVL 11

Expert Comment

by:calinutz
ID: 17053580
You should try requesting help from their website. They will probabely help you.
0
 
LVL 1

Author Comment

by:winexec
ID: 17054139
Thanks, it's fixed now, I should have been using another function, SendToRaw.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 17983757
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question