[futurebasic] Re: [FB] email

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2012 : Group Archive : Group : All Groups

From: Douglas Stemen <dstemen@...>
Date: Sun, 12 Aug 2012 12:47:22 -0400
Ken,

This answered my question. Everything now works.

Thanks again.

Doug

On Aug 12, 2012, at 11:42 AM, Ken Shmidheiser wrote:

> Doug asked:
> 
>> I need to make a CF string from a variable for everything. Can you tell me how to do this?
> 
> 
> Doug,
> 
> I don't quite understand exactly what you want. You can create CFStringRef variables for input into the function in several different ways. Try using the code below in the demo.
> 
> If you want a single CFStringRef that includes name, address, subject, and message, the SendMail function would have to be rewritten to parse the fields from the single string. The easiest way would be to create a CFArray from the CFString and parse out each field.
> 
> A little clarification would help.
> 
> Ken
> 
> '-------------- Main -----------------
> 
> dim as Str255 s
> dim as CFStringRef name, address, subject
> dim as CFMutableStringRef message
> 
> // From Pascal string
> s = "John Doe"
> name = fn CFStringCreateWithPascalString( 0, #s, _kCFStringEncodingMacRoman )
> 
> // Copy literal string
> address = fn CFStringCreateCopy( _kCFAllocatorDefault, @"johndoe@..." )
> 
> // Create with format
> subject = fn CFStringCreateWithFormat( _kCFAllocatorDefault, NULL, @"%@", @"Subject line for test." )
> 
> // Create mutable string
> message = fn CFStringCreateMutable( _kCFAllocatorDefault, 0 )
> CFStringAppend ( message, @"Here is some text for the message.\n\n" )
> CFStringAppend ( message, @"The message body can be as long as you like." )
> 
> fn SendEmail( name, address, subject, message )
> 
> CFRelease( name )
> CFRelease( address )
> CFRelease( subject )
> CFRelease( message )
> 
> 
> 
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
> To access the list archives, go to:  http://freegroups.net/groups/futurebasic/
>