Email gateway settings head<= <=head body<= {user} : 'exampleusername'; my $need_login = (! $u && ! $GET{mode}) ? 1 : 0; my @address = split(/\s*,\s*/, $u->{emailpost_allowfrom}); my $addr = $address[0] || 'allowed_sender@example.com'; $addr =~ s/\(\w\)$//; my $pin = $u->{emailpost_pin} || 'PIN'; my $to = "To: $user" . '@' . $LJ::EMAIL_POST_DOMAIN . '
'; my $to_pin = "To: $user+$pin" . '@' . $LJ::EMAIL_POST_DOMAIN . '
'; my $subject = "Subject: Neat, I can post via email." . '

'; my $from = "From: $addr
"; my $body = "This is the body of my post."; if ($need_login) { $ret .= ''; $ret .= ""; } my @topics = ( { name => 'pin', title => 'Pin usage examples', url => '?mode=help&type=pin', text => qq{
PIN in email address +$pin\@$LJ::EMAIL_POST_DOMAIN
$from $subject $body emailex?>
PIN in subject +$pin Post subject

$body emailex?>
PIN in body +$pin $body emailex?>
} }, { name => 'optional', title => 'Optional features', url => '?mode=help&type=optional', text => qq{
Posting to a community community+$pin\@$LJ::EMAIL_POST_DOMAIN
$from $subject $body emailex?>
Removing unwanted text --
This text and anything underneath it will be ignored, including automatic signatures added by free email services.
__________________________________________________
Try the all new SUPER FREE MAIL version 17 today!!!
emailex?>
Hyphens and underscores some-user.some-community+$pin\@$LJ::EMAIL_POST_DOMAIN
$from $subject $body emailex?>
} }, { name => 'headers', title => 'LJ headers and security', url => '?mode=help&type=headers', text => qq{
Journal entry options lj-userpic: pict keywords
lj-tags: greyhounds, potato, wool
lj-mood: happy
lj-music: The Pixies: Where is my mind?
lj-comments: ("off" or "noemail")

$body emailex?>
Journal entry security
lj-security: public
The post is posted publicly.

lj-security: private
The post is posted privately.

lj-security: friends
The post can only be viewed by those on your friends list.

lj-security: friendgroup
This is literally the name of a friend group. Only friends belonging to that group can view the post.
Example: lj-security: my friends

} }, { name => 'advanced', title => 'Advanced usage', url => '?mode=help&type=advanced', text => qq{
PGP/GPG message signing PGP" instead of your PIN, allowed sender addresses and the saved PIN are completely ignored. Your email will only be posted if it is signed with a valid PGP/GPG private key. p?> here. p?> +PGP\@$LJ::EMAIL_POST_DOMAIN
From: anywhere\@example.com
$subject $body
This body should be properly signed with my private key. emailex?>
} }, ); if ($LJ::FB_SITEROOT && %LJ::FOTOBILDER_IP && ! $LJ::DISABLED{fb_email_docs}) { $subject = "Subject: Neat, I can post pictures via email.

"; $body = "This is the body of my post, with image attachments."; splice @topics, -1, 0, { name => 'images', title => 'Image attachments', url => '?mode=help&type=images', subject => body => text => qq{
$LJ::FB_DOMAIN account and displayed in your journal entry. All images are displayed under a lj-cut. Using lj-headers, You can change the way the images look in your journal, as well as set various image attributes. p?>
Choosing a gallery lj-gallery header. If unspecified, the default gallery is 'LJ_emailpost'. If you decide to move your images into different galleries in the future, the images posted in your journal will still work correctly. p?> lj-gallery: vacation photos

$body emailex?>
Image security lj-imgsecurity header to change this behavior. Please note that image security is separate from your journal entry security! For example, you can have a journal entry that is private, while the pictures within it are public. This feature only changes the security on the images themselves - not the journal entry. p?> lj-imgsecurity: private

$body emailex?>
Changing the image display size lj-imgsize header. p?> lj-imgsize: 640x480

$body emailex?>
Changing image layout lj-imglayout header.

By default, multiple images will be placed in a vertical layout:




Currently, the only other option is "horizontal". p?>

lj-imglayout: horizontal

$body emailex?>
lj-cut behavior lj-cut. By default, the cut description is the number of images uploaded. If you attached 3 images in your email message, the lj-cut would read, "( 3 images )". Setting the lj-imgcut header to "titles" changes the cut caption to the title of the filename, one cut per image. "( emo.jpg ) ( pict002.jpg ) ( me_and_bob.jpg )" p?> lj-imgcut: titles

$body emailex?>
} }; } # index by name, record order my %topics_by_name; my $ct = 0; foreach my $t (@topics) { $t->{order} = $ct; $topics_by_name{$t->{name}} = $t; $ct++; } my $topic = $topics_by_name{$type}; if (! $type) { $ret .= < + symbol. You must be sending the message from an email address on your "Allowed sender addresses" list. If you embed your PIN in either the subject or the body, it will be automatically removed before posting. p?> EOT } # list of topics $ret .= ''; $ret .= '

' if $type; # content $ret .= $topic->{text} if $topic; $ret .= "
"; # next/last links if ($topic->{order} && $topics[$topic->{order} - 1]) { my $lastt = $topics[$topic->{order} - 1]; $ret .= "[ << $lastt->{title} ]   "; } if ($topics[$topic->{order} + 1]) { $topic->{order} = -1 if ! $type; my $nextt = $topics[$topic->{order} + 1]; $ret .= "[ $nextt->{title} >> ]"; } return $ret; } #-------------------------------------------------------------------------- # Update settings if ($POST{userid} == $u->{userid}) { my @errors; my $addresses = $POST{addresses}; my $pin = $POST{pin}; # needs $ML{'.error.pin'} $pin =~ s/\s+//g; push @errors, "Your PIN is currently limited to alphabet characters and numbers, and needs to be at least 4 characters long." unless $pin =~ /^([a-z0-9]){4,20}$/i or $pin eq ''; push @errors, "This PIN is invalid. You should change it to something that does NOT have anything to do with your $LJ::SITENAMESHORT account." if $pin eq $u->{password} or $pin eq $u->{user}; # Check email, add flags if needed. my %allowed; my $addrcount = 0; foreach (split(/\0/, $addresses)) { s/\s+//g; next unless $_; next if length > 80; $_ = lc; push @errors, "Invalid email address: " . LJ::ehtml($_) unless /\@/; $allowed{$_} = {}; $allowed{$_}->{'get_errors'} = 1 if $POST{"check_$addrcount"}; $addrcount++; } if ( $POST{'emailpost_imgcut'} eq 'none' && $POST{'email_imgsize'} ne 'default' ) { my ($w, $h) = split 'x', $POST{'emailpost_imgsize'}; push @errors, "Image size must be 320x240 or less to disable the lj-cut." if $w > 320 || $h > 240; } return LJ::bad_input(@errors) if @errors; LJ::Emailpost::set_allowed_senders($u, \%allowed); foreach my $prop (@props) { next if $prop =~ /emailpost_(allowfrom|pin)/; next if $u->{'prop'} eq $POST{$prop}; if ($POST{$prop} && $POST{$prop} ne 'default') { $POST{$prop} = undef if $prop eq 'emailpost_gallery' && $POST{$prop} eq 'LJ_emailpost'; LJ::set_userprop($u, $prop, $POST{$prop}); } else { LJ::set_userprop($u, $prop, undef); } } LJ::set_userprop($u, "emailpost_pin", $pin); my $ret; $ret .= ""; $ret .= ""; $ret .= "here for information on how to use this feature. p?>"; if ($LJ::HELPURL{emailpost}) { $ret .= ""; $ret .= ""; } return $ret; } #-------------------------------------------------------------------------- # Initial page my $addrlist = LJ::Emailpost::get_allowed_senders($u); my (@address, $res, $ret); push @address, $_ foreach sort keys %$addrlist; # get userpics and friendgroups $res = LJ::Protocol::do_request( "login", { "ver" => ( $LJ::UNICODE ? "1" : "0" ), "username" => $u->{'user'}, "friendgroups" => 1, "getpickws" => 1, }, undef, { "noauth" => 1, } ); my @groups = map { $_->{'name'} } @{ $res->{'friendgroups'} }; unshift @groups, $_ foreach qw/ -------- friends private public default /; my @userpics = @{ $res->{'pickws'} }; unshift @userpics, $_ foreach qw/ default /; $ret .= "instructions. p?>
"; unless (LJ::get_cap($u, 'emailpost')) { $ret .= "Sorry, updating your journal via email is not available for your account type."; return $ret; } $ret .= ""; $ret .= ""; $ret .= "
\n"; $ret .= LJ::html_hidden(userid => $u->{userid}); $ret .= "
"; $ret .= ''; for(0..2) { # Limited to 3 addresses. $ret .= ''; } $ret .= '
Address:Send errors?
'; my $selected = 0; $ret .= LJ::html_text({name=>'addresses', value=>$address[$_], size=>40, maxlength=>80}); $ret .= ''; $selected = 1 if $addrlist->{$address[$_]}->{'get_errors'}; $ret .= '
' . LJ::html_check({name => "check_$_", selected => $selected}) . '
'; $ret .= '

'; $ret .= ""; $ret .= ""; $ret .= "
"; $ret .= LJ::html_text({name=>'pin', value=>$u->{emailpost_pin}, maxlength=>20}); $ret .= '

'; $ret .= ""; $ret .= "here. p?>"; $ret .= "
"; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; if ($LJ::FB_SITEROOT && %LJ::FOTOBILDER_IP && LJ::get_cap($u, 'fb_account')) { $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; } $ret .= "
Userpic:"; $ret .= LJ::html_select({ name=> 'emailpost_userpic', selected => $u->{'emailpost_userpic'} }, map { $_ => $_ } @userpics); $ret .= "
Security:"; $ret .= LJ::html_select({ name=> 'emailpost_security', selected => $u->{'emailpost_security'} }, map { $_ => $_ } @groups); $ret .= "
Comments:"; $ret .= LJ::html_select({ name=> 'emailpost_comments', selected => $u->{'emailpost_comments'} }, 'default','default','noemail','No email','off','off'); $ret .= "
 
Gallery name:"; $ret .= LJ::html_text({ name=> 'emailpost_gallery', value => $u->{'emailpost_gallery'} || 'LJ_emailpost' }); $ret .= "
Image security:"; $ret .= LJ::html_select({ name=> 'emailpost_imgsecurity', selected => $u->{'emailpost_imgsecurity'} }, default => 'default',public => 'public', regusers => 'registered users', friends => 'friends', private => 'private'); $ret .= "
Image size:"; $ret .= LJ::html_select({ name=> 'emailpost_imgsize', selected => $u->{'emailpost_imgsize'} }, map { $_ => $_ } qw/ default 100x100 320x240 640x480 /); $ret .= "
Image layout:"; $ret .= LJ::html_select({ name=> 'emailpost_imglayout', selected => $u->{'emailpost_imglayout'} }, map { $_ => $_ } qw/ default horizontal vertical /); $ret .= "
Image cut type:"; $ret .= LJ::html_select({ name=> 'emailpost_imgcut', selected => $u->{'emailpost_imgcut'} }, map { $_ => $_ } qw/ default titles none /); $ret .= "
"; $ret .= '

'; $ret .= ""; $ret .= "
"; return $ret; } _code?> <=body page?>