I spent weeks on the following problem. Your guidance & insight will be 
invaluable!

How to create a
 single C
ompose form that will take all the needed parameters – *Including* *
Attachments* –
  
and send the Email via SMTP server or Save the Email to IMAP server?


The following code was tried to
  
S
end
  Email using SMTP
, but *how to Send**
  Mutliple 
Attachments
 that way?*

*

*
*
sendForm = Compose Form
*
*
SendSMTP = SMTP send
*
*
sendConfirm = Debug Confirmation
*




def sendForm():
    form = SQLFORM <http://127.0.0.1:8000/examples/global/vars/SQLFORM>.factory(
        Field <http://127.0.0.1:8000/examples/global/vars/Field>("subject", 
requires=IS_NOT_EMPTY 
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>()),
        Field <http://127.0.0.1:8000/examples/global/vars/Field>("body", 
"text", requires=IS_NOT_EMPTY 
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>()),
        Field <http://127.0.0.1:8000/examples/global/vars/Field>("to", 
requires=IS_NOT_EMPTY 
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>()),
        Field <http://127.0.0.1:8000/examples/global/vars/Field>("attachment", 
"upload") )
    if form.accepts(request 
<http://127.0.0.1:8000/examples/global/vars/request>.vars, session 
<http://127.0.0.1:8000/examples/global/vars/session>):
        session <http://127.0.0.1:8000/examples/global/vars/session>.subject = 
form.vars.subject
        session <http://127.0.0.1:8000/examples/global/vars/session>.body = 
form.vars.body
        session <http://127.0.0.1:8000/examples/global/vars/session>.to = 
form.vars.to
        # *session.attachment = form.vars.attachment*
        redirect <http://127.0.0.1:8000/examples/global/vars/redirect>(URL 
<http://127.0.0.1:8000/examples/global/vars/URL>(f="SendSMTP"))
    return dict(form=form)


def SendSMTP():
    mail.send(
            session <http://127.0.0.1:8000/examples/global/vars/session>.to,
            session 
<http://127.0.0.1:8000/examples/global/vars/session>.subject,
            session <http://127.0.0.1:8000/examples/global/vars/session>.body )
    session <http://127.0.0.1:8000/examples/global/vars/session>.flash = 
"Message Sent To : ", session 
<http://127.0.0.1:8000/examples/global/vars/session>.to
    redirect <http://127.0.0.1:8000/examples/global/vars/redirect>(URL 
<http://127.0.0.1:8000/examples/global/vars/URL>(f="sentConfirm"))
    return dict()


def sentConfirm():
    return dict(
        to = session <http://127.0.0.1:8000/examples/global/vars/session>.to,
        subject = session 
<http://127.0.0.1:8000/examples/global/vars/session>.subject,
        body = session 
<http://127.0.0.1:8000/examples/global/vars/session>.body,
        # *attachment = session.attachment*
        )


*QUESTIONS*


   - *How to create a Compose form and Send**
    Multiple 
    Attachments
   ?*
   - *How to use the Same Form to Save as Draft – including the Attachments 
   – on the IMAP server?*
   - *
   The above must be done without using any additional backend DB
    — must be done using only IMAP and SMTP
   .*








 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to