# sending email thru URL encoding or NSMailDelivery



## nasbtv (Sep 18, 2006)

hi frens..

 i have the problem in sending the email thru the code in cocoa. my problem is;
 i have encoded URL proply with subject,to etc. and i have used NSWorkspace openurl to send the mail. but it opens apple mail and waits for user to press send. but i want to send silently without user noticing it..how can i do this..plzzz help.. i am new switcher to mac. in windows i had done this very easily


----------



## Viro (Sep 18, 2006)

This sounds quite dodgy, sending an email without the user's knowledge.


----------



## lurk (Sep 18, 2006)

I don't think that you can do this using the basic stuff, because as Viro mentioned it is kind of dodgy.  You can always do it the old fashioned way and open a connection for port 25 on your SMTP server and hope there are no firewalls blocking you...

Or you might be albe to do it via Applescript and Mail.app.  But then it will fail for Entourage users...  And Thunderbird users....

Are you sure that that worked on Windows, I cannot imagine that they did not have the same issues.


----------



## nasbtv (Sep 22, 2006)

lurk said:


> I don't think that you can do this using the basic stuff, because as Viro mentioned it is kind of dodgy.  You can always do it the old fashioned way and open a connection for port 25 on your SMTP server and hope there are no firewalls blocking you...
> 
> Or you might be albe to do it via Applescript and Mail.app.  But then it will fail for Entourage users...  And Thunderbird users....
> 
> Are you sure that that worked on Windows, I cannot imagine that they did not have the same issues.



-Hi..
Thank u for ur help...

 In windows when i used smtp method i did not find any problem.it worked very well. but in mac NSMailDelivery returns No even though MAIL.app is configed proply.. 
 since i am working on automatic mail delivery, URL encoding does not seem to work becoz it asks user to press send button.

 For me apple script also no problem if i am able to execute it thru objective-C. Totally some how it should send the mail irrespective of email client installed.

 i need a script which which silently attaches a file of specified path..and should send it upon execution. 

Please do help me....please


----------



## nasbtv (Sep 22, 2006)

I found many people in the net searching solution for the same problem.i think for mac u don get enough help tooo..so if at all if u reply here it wud help 1000 others... 

Thankx in advance...


----------



## Viro (Sep 22, 2006)

It still sounds ridiculously dodgy, having to send an email without the user's knowledge. You could always do it manually, i.e. communicating directly with the SMTP server, and sending the email.


----------



## nasbtv (Sep 22, 2006)

Viro said:


> It still sounds ridiculously dodgy, having to send an email without the user's knowledge. You could always do it manually, i.e. communicating directly with the SMTP server, and sending the email.



ok...then how to send the mail programatically in cocoa? i hope atleast others unstud my problem...


----------



## lurk (Sep 22, 2006)

Well if you used the smtp method in windows you do it the same on a mac, you open a connection to port 25 and start talking SMTP.  The fact that you had to ask how to do this on a mac kind of tells me that you did not use raw SMTP under windows.  It is so low level it is the same everywhere.

The point that Viro is trying to make is that to send mail you have to use some sort of credential.  (Now it might be enough that you are on a trusted network.) What I really think you might be asking is "How do I 'borrow' the credential of the user's trusted email client and send mail without their knowledge."  The Mac answer is that you don't, you request that the program that possesses the trusted credential performs the operation on your behalf.   

At this point like no trusted mail program is willing to send the message for you without user interaction.  Really, I think that what you need to do is prompt the user for their email credentials and send it yourself.  Something like,

"In order to secretly send files back to my server please enter the address of your local SMTP server, you login and password."

Personally, I would not do it because it sounds dodgy.  The problem you are having getting the information you want is that we understand technically what you are trying to do but we cannot see anything but dishonest reasons for doing it.  For the most part because there are better ways of doing almost anything you would want to do legitimately.  

Maybe if you tell us what you really are trying to accomplish we could help.


----------



## Captain Code (Sep 24, 2006)

Please specify why you are trying to do this.  To me and many others it sounds like you're trying to steal a file from a user's computer and silently email it to somewhere.


----------



## nasbtv (Oct 4, 2006)

hi..
actully i am working for a   company. Now i hav been a project wher i have to send mail to client. body of the mail will be ther in the textview. as soon as i click send button in my application, it shud silently send the mail to the respective email ids. this is what i wanted.... please help me!

If at all any one knows how to send the attachments plz put it here.. it wud be helpful for me as well as sooo many others

thanks in advance


----------

