我目前正在使用Mailgun检查我的应用程序中收到的电子邮件。到目前为止,我可以获得电子邮件的收件人,发件人和正文;但不是主题。
random.shuffle(alist)
我可以在邮件标题中看到主题:
from tkinter import *
from tkinter.ttk import *
import random
import tkinter
class KeyboardGame:
def __init__(self):
window = Tk()
window.title('haha')
self.value = StringVar()
self.value.set('click on any key to start...')
btm_frame = Frame(window, relief=RAISED)
entry = Entry(window, text=self.value)
entry.grid(row=0, column=0, padx=40, pady=5, sticky='EW')
for i in ['ixnsywfhze', 'uobpqgtav', 'lmjkcdr']:
frame1 = Frame(btm_frame)
for j in i:
button = Button(frame1, text=j, command=self.game)
button.pack(side=LEFT)
frame1.pack(padx=2, pady=2)
btm_frame.grid(row=1, column=0, padx=5, pady=5)
window.mainloop()
def game(self):
n = 0
alist = ['h', 'c', 'p', 'e', 'm', 'n', 'd']
self.value.set(alist[n])
while button['text'] != alist[n]:
self.value.set(alist[n])
n += 1
KeyboardGame()
返回以下内容:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout">
<Button
android:id="@+id/seven"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
<Button
android:id="@+id/eight"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
<Button
android:id="@+id/nine"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="@+id/zero"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout"
android:layout_marginTop="98dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
这看起来是一个数组,但是通过is_array运行它,返回false。
我尝试过的代码:
$recipient = $request->input('recipient'); <-- Working
$sender = $request->input('sender'); <-- Working
$body = $request->input('body-html'); <-- Working
$subject = $request->input('subject'); <-- Not Working
RETURNS:ErrorException为foreach()提供的参数无效
答案 0 :(得分:0)
$subject = null;
foreach ($data as $header) {
if ($header[0] == 'Subject') {
$subject = $header[1];
break;
}
}