• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to make mailto: links clickable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make mailto: links clickable


  • Subject: Re: How to make mailto: links clickable
  • From: Lorenzo Puleo <email@hidden>
  • Date: Wed, 10 Apr 2002 12:51:54 +0200

>In my app I have bunch of e-mail addresses and I would link them to work the
>same way they do as the Mailto: command in HTML. Does anyone know how? (I
>know how to do URL links, but now e-mails...)

Hi,
I don't know how to make text-links clickable, but I can tell you how to
send emails from "within" your application (thus without launching other
applications like Outlook or Eudora):


-----------------------------------
//////////////
NSString *messageBody, *messageSubject, *destinationAddress;
BOOL ok;

messageBody = @"This is the body of my email";
messageSubject = @"This is the subject of my email";
destinationAddress = @"email@hidden";

ok = [NSMailDelivery deliverMessage:messageBody subject:messageSubject
to:destinationAddress];
// ok = YES in case of email sent, ok = NO in case email not sent.
//////////////


-----------------------------------
There is a second way to send emails, with attributed strings in the body:
//////////////
NSAttributedString *messageBody;
NSMutableDictionary *messageHeaders;

messageHeaders = [[NSMutableDictionary alloc] init];
[messageHeaders setObject:@"email@hidden" forKey:@"To"];
[messageHeaders setObject:@"The subject of my email" forKey:@"Subject"];
[messageHeaders setObject:@"email@hidden" forKey:@"Cc"];
[messageHeaders setObject:@"email@hidden" forKey:@"BCc"];
// etc, etc.
messageBody = [[NSAttributedString alloc] initWithString: @"This is without
attributes, but you can set this with attributes"];

ok = [NSMailDelivery deliverMessage:messageBody headers:messageHeaders
format:NSMIMEMailFormat protocol:NSSMTPDeliveryProtocol];

[messageBody release];
[messageHeaders release];
//////////////


-----------------------------------
I hope this helps.
I would like to know how to make text-links clickable too.

:-)
--
Lorenzo Puleo
mailto:email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re(2): why Obj-C
  • Next by Date: Re: NSBezierPath techniques?
  • Previous by thread: Re: How to make mailto: links clickable
  • Next by thread: Getting mounted network paths
  • Index(es):
    • Date
    • Thread